Back Midas Rome Roody Rootana
  Rome Analyzer Framework, Page 6 of 11  Not logged in ELOG logo
ID Date Author Topicdown Subject
  199   14 Apr 2016 SUDESHNA GANGULYInfoError with maximum number of tabs in Argus section
I've fixed the problem of not being able to define 18 tabs. I edited
/argus/include/ArgusHistoDisplay.h file:
I changed the parameter values to:

class ArgusHistoDisplay : public ArgusTab
{
protected:
   enum {
      kMaxNumberOfPads = 360,
      kMaxNumberOfPadsX = 10,
      kMaxNumberOfPadsY = 20,
      kNumberOfDisplayViewSelections0 = 54,
      kNumberOfDisplayViewSelections1 = 10,
      kNumberOfDisplayViewSelections2 = 10,
      kMaxNumberOfLines = 81
   };

Now I can define 18 tabs with 3 pads in each.




> Hi Ryu,
> 
> I am trying to use <Argus> for tabbing like this:
>   <Argus>
>           <Tab>
>             <TabName>Tab1</TabName>
>             <ObjectArrayIndex>0</ObjectArrayIndex>
> 
>             <Index>0</Index>
>  </Tab>
>    <Tab>
>             <TabName>Tab1</TabName>
>             <ObjectArrayIndex>1</ObjectArrayIndex>
>             <Index>1</Index>
>           </Tab>
>    <Tab>
>             <TabName>Tab1</TabName>
>             <ObjectArrayIndex>2</ObjectArrayIndex>
> 
>             <Index>2</Index>
>           </Tab>
> 
> 
> 
> 
> And I need to add 18 tabs with each tab having three pads.
> Now I when ever I cross Tab6 with three pads on it, it gives me this error:
> 
> [sganguly@g2be1 rometest]$ /home/sganguly/dqm/rome/bin/romebuilder.exe -i
> midas.xml -midas
> Maximal number of Tabs in the Argus section of Histogram 'h1_wf' reached : 20 !
> 
> I have noticed that currently I can define 6 tabs and 5 pads on each tab maximum.
> 
> Could you please help me with this?
> 
> Thanks a lot!
> Sudeshna
  200   14 Apr 2016 SUDESHNA GANGULYInfoIs auto-update available for tabs with user-defined codes (not with <Argus>) ?
Is it possible to have the pads automatically updated with the update frequency
(set at romeConfig.xml) while using user-defined src/tabs codes? 
Suppose I write a tab code under src/tabs where I have created an "update" button. 
Now on the Argus display monitor, if I click on the "update" button, the display
will be updated. But what I've noticed is that clicking on the update button
introduces a delay. By the time the display is actually updated I've missed some
events already. 

Is there any way to sync the update button with the update frequency in the
romeConfig.xml? So that it keeps up with every event?

I would really appreciate if anyone have any suggestion for this situation.

Thanks a lot!
Sudeshna
  201   15 Apr 2016 Ryu SawadaInfoIs auto-update available for tabs with user-defined codes (not with <Argus>) ?
Dear Sudeshna

The easiest way would be to call your "Update" function from EventHandler function of your tabs.

You may or may not have a function named "Update", but I believe you must have a function to update your graphics 
when your "Update" button is clicked.
You can call the same thing from EventHandler function, then it will keep the display updated.

If you want to control the frequency of the update of each tab, you can see two examples,
  $ROMESYS/examples/argus/thread/
  $ROMESYS/examples/argus/timer/
The examples update the display with using different tools (making other update thread or by using TTimer of ROOT).

Ryu

> Is it possible to have the pads automatically updated with the update frequency
> (set at romeConfig.xml) while using user-defined src/tabs codes? 
> Suppose I write a tab code under src/tabs where I have created an "update" button. 
> Now on the Argus display monitor, if I click on the "update" button, the display
> will be updated. But what I've noticed is that clicking on the update button
> introduces a delay. By the time the display is actually updated I've missed some
> events already. 
> 
> Is there any way to sync the update button with the update frequency in the
> romeConfig.xml? So that it keeps up with every event?
> 
> I would really appreciate if anyone have any suggestion for this situation.
> 
> Thanks a lot!
> Sudeshna
  202   15 Apr 2016 Ryu SawadaInfoError with maximum number of tabs in Argus section
Dear Sudeshna

I commit the change to the 'develop' branch.

Ryu

> I've fixed the problem of not being able to define 18 tabs. I edited
> /argus/include/ArgusHistoDisplay.h file:
> I changed the parameter values to:
> 
> class ArgusHistoDisplay : public ArgusTab
> {
> protected:
>    enum {
>       kMaxNumberOfPads = 360,
>       kMaxNumberOfPadsX = 10,
>       kMaxNumberOfPadsY = 20,
>       kNumberOfDisplayViewSelections0 = 54,
>       kNumberOfDisplayViewSelections1 = 10,
>       kNumberOfDisplayViewSelections2 = 10,
>       kMaxNumberOfLines = 81
>    };
> 
> Now I can define 18 tabs with 3 pads in each.
> 
> 
> 
> 
> > Hi Ryu,
> > 
> > I am trying to use <Argus> for tabbing like this:
> >   <Argus>
> >           <Tab>
> >             <TabName>Tab1</TabName>
> >             <ObjectArrayIndex>0</ObjectArrayIndex>
> > 
> >             <Index>0</Index>
> >  </Tab>
> >    <Tab>
> >             <TabName>Tab1</TabName>
> >             <ObjectArrayIndex>1</ObjectArrayIndex>
> >             <Index>1</Index>
> >           </Tab>
> >    <Tab>
> >             <TabName>Tab1</TabName>
> >             <ObjectArrayIndex>2</ObjectArrayIndex>
> > 
> >             <Index>2</Index>
> >           </Tab>
> > 
> > 
> > 
> > 
> > And I need to add 18 tabs with each tab having three pads.
> > Now I when ever I cross Tab6 with three pads on it, it gives me this error:
> > 
> > [sganguly@g2be1 rometest]$ /home/sganguly/dqm/rome/bin/romebuilder.exe -i
> > midas.xml -midas
> > Maximal number of Tabs in the Argus section of Histogram 'h1_wf' reached : 20 !
> > 
> > I have noticed that currently I can define 6 tabs and 5 pads on each tab maximum.
> > 
> > Could you please help me with this?
> > 
> > Thanks a lot!
> > Sudeshna
  203   18 Apr 2016 SUDESHNA GANGULYInfoClear histogram/group of histograms at the beginning of run in ROME
Hi All,

Is there any way in ROME that I can clear histograms at:

    1)Run start.
    2) Clear by group (tab) ?


Thanks a lot!
Sudeshna
  204   21 Apr 2016 Ryu SawadaInfoClear histogram/group of histograms at the beginning of run in ROME
Dear Sudeshna,

In ROME, histograms are associated with a task (not with a tab).

Histograms are reset at the beginning of runs when "HistAccumulate" is false.
You can set it in your configuration XML like,
          <Histogram>
            <HistName>MyHisto</HistName>
            <HistAccumulate>false</HistAccumulate>
          </Histogram>

If you want to clear by hand, you can use ResetHisto() function of your tasks; the function is automatically implemented by ROMEbuilder.

Ryu

> Hi All,
>
> Is there any way in ROME that I can clear histograms at:
>
> 1)Run start.
> 2) Clear by group (tab) ?
>
>
> Thanks a lot!
> Sudeshna
  206   06 May 2016 SUDESHNA GANGULYInfoCan we reset histograms at the middle of a run in ROME?
Hi All,

Suppose I want to pause a run, at the middle, and change some run conditions. So
I want to clear histograms at the middle of a run. Is that possible to do in ROME?

That when I pause the run, I want to clear histograms. So with the new run
conditions, when we resume that run, we will get clear pads and histograms will
be filled in new.


Thanks a lot!
Sudeshna
  207   11 May 2016 Ryu SawadaInfoCan we reset histograms at the middle of a run in ROME?
Dear Sudeshna,

I added a new button to clear histograms.


Please update your ROME and use the 'develop' branch.

Best regards,

Ryu

> Hi All,
>
> Suppose I want to pause a run, at the middle, and change some run conditions. So
> I want to clear histograms at the middle of a run. Is that possible to do in ROME?
>
> That when I pause the run, I want to clear histograms. So with the new run
> conditions, when we resume that run, we will get clear pads and histograms will
> be filled in new.
>
>
> Thanks a lot!
> Sudeshna
  208   29 Nov 2017 Yusuke UchiyamaInfoCompiler warning
Dear all,

Under the environment with GCC4.8.5 and ROOT6.08.04,
we get the following warning messages when compiling XXXAnalyzer3, XXXAnalyzer4, 
XXXConfig, XXXConfig2,3,4, XXXDBAccess, and XXXConfigToForm.


In file included from /usr/include/stdlib.h:24:0,
                 from /meg/data1/shared/mc/benchmark_test/rome3-root6.08.04-
gcc485/include/ROMEAnalyzer.h:10,
                 from include/generated/MEGPrecompile.h:23,
                 from <command-line>:0:
/usr/include/features.h:330:4: warning: #warning _FORTIFY_SOURCE requires compiling 
with optimization (-O) [-Wcpp]
 #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    ^
[345/369] compiling obj/MEGAnalyzer4.o
In file included from /usr/include/stdlib.h:24:0,
                 from /meg/data1/shared/mc/benchmark_test/rome3-root6.08.04-
gcc485/include/ROMEAnalyzer.h:10,
                 from include/generated/MEGPrecompile.h:23,
                 from <command-line>:0:
/usr/include/features.h:330:4: warning: #warning _FORTIFY_SOURCE requires compiling 
with optimization (-O) [-Wcpp]
 #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    ^

It seems due to 'NOOPT' flag added to those objects in the Makefile.
Is the 'NOOPT' flag necessary? If not, how can we remove it?

Regards,
Yusuke
  209   29 Nov 2017 Ryu SawadaInfoCompiler warning
Hi Yusuke

NOOPT is added for potentially large source files to reduce the compile time and memory usage.

I guess -D_FORTIFY_SOURCE option is added in your project Makefile or in your environment variable, instead of by 
ROME.
However, we could modify ROME to explicitly disable it by adding -D_FORTIFY_SOURCE=0 to NOOPT.
That can be done by modifying builder/src/ROMEBuildMakeFile.cpp line 1348.

Could you try to do it ?

Ryu


> Dear all,
> 
> Under the environment with GCC4.8.5 and ROOT6.08.04,
> we get the following warning messages when compiling XXXAnalyzer3, XXXAnalyzer4, 
> XXXConfig, XXXConfig2,3,4, XXXDBAccess, and XXXConfigToForm.
> 
> 
> In file included from /usr/include/stdlib.h:24:0,
>                  from /meg/data1/shared/mc/benchmark_test/rome3-root6.08.04-
> gcc485/include/ROMEAnalyzer.h:10,
>                  from include/generated/MEGPrecompile.h:23,
>                  from <command-line>:0:
> /usr/include/features.h:330:4: warning: #warning _FORTIFY_SOURCE requires compiling 
> with optimization (-O) [-Wcpp]
>  #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
>     ^
> [345/369] compiling obj/MEGAnalyzer4.o
> In file included from /usr/include/stdlib.h:24:0,
>                  from /meg/data1/shared/mc/benchmark_test/rome3-root6.08.04-
> gcc485/include/ROMEAnalyzer.h:10,
>                  from include/generated/MEGPrecompile.h:23,
>                  from <command-line>:0:
> /usr/include/features.h:330:4: warning: #warning _FORTIFY_SOURCE requires compiling 
> with optimization (-O) [-Wcpp]
>  #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
>     ^
> 
> It seems due to 'NOOPT' flag added to those objects in the Makefile.
> Is the 'NOOPT' flag necessary? If not, how can we remove it?
> 
> Regards,
> Yusuke
  210   29 Nov 2017 Yusuke UchiyamaInfoCompiler warning
Hi Ryu,

Thank you.
You are right. We add -D_FORTIFY_SOURCE=2 in CFLAGS and CXXFLAGS in our project Makefile.
If we remove it, the warnings go away.

I tried your suggestion but I got the following warning: 

[346/369] compiling obj/MEGAnalyzer3.o
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition

However, if I add 
'-U_FORTIFY_SOURCE' instead the warning above disappears.

Do you think it is OK for all?

Regards,
Yusuke

> Hi Yusuke
> 
> NOOPT is added for potentially large source files to reduce the compile time and memory usage.
> 
> I guess -D_FORTIFY_SOURCE option is added in your project Makefile or in your environment variable, instead of by 
> ROME.
> However, we could modify ROME to explicitly disable it by adding -D_FORTIFY_SOURCE=0 to NOOPT.
> That can be done by modifying builder/src/ROMEBuildMakeFile.cpp line 1348.
> 
> Could you try to do it ?
> 
> Ryu
> 
> 
> > Dear all,
> > 
> > Under the environment with GCC4.8.5 and ROOT6.08.04,
> > we get the following warning messages when compiling XXXAnalyzer3, XXXAnalyzer4, 
> > XXXConfig, XXXConfig2,3,4, XXXDBAccess, and XXXConfigToForm.
> > 
> > 
> > In file included from /usr/include/stdlib.h:24:0,
> >                  from /meg/data1/shared/mc/benchmark_test/rome3-root6.08.04-
> > gcc485/include/ROMEAnalyzer.h:10,
> >                  from include/generated/MEGPrecompile.h:23,
> >                  from <command-line>:0:
> > /usr/include/features.h:330:4: warning: #warning _FORTIFY_SOURCE requires compiling 
> > with optimization (-O) [-Wcpp]
> >  #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
> >     ^
> > [345/369] compiling obj/MEGAnalyzer4.o
> > In file included from /usr/include/stdlib.h:24:0,
> >                  from /meg/data1/shared/mc/benchmark_test/rome3-root6.08.04-
> > gcc485/include/ROMEAnalyzer.h:10,
> >                  from include/generated/MEGPrecompile.h:23,
> >                  from <command-line>:0:
> > /usr/include/features.h:330:4: warning: #warning _FORTIFY_SOURCE requires compiling 
> > with optimization (-O) [-Wcpp]
> >  #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
> >     ^
> > 
> > It seems due to 'NOOPT' flag added to those objects in the Makefile.
> > Is the 'NOOPT' flag necessary? If not, how can we remove it?
> > 
> > Regards,
> > Yusuke
  211   29 Nov 2017 Ryu SawadaInfoCompiler warning
Hi.

Thank you for testing.

-U_FORTIFY_SOURCE is fine, and can be implemented in ROME.

Ryu

> Hi Ryu,
> 
> Thank you.
> You are right. We add -D_FORTIFY_SOURCE=2 in CFLAGS and CXXFLAGS in our project Makefile.
> If we remove it, the warnings go away.
> 
> I tried your suggestion but I got the following warning: 
> 
> [346/369] compiling obj/MEGAnalyzer3.o
> <command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
> <command-line>:0:0: note: this is the location of the previous definition
> 
> However, if I add 
> '-U_FORTIFY_SOURCE' instead the warning above disappears.
> 
> Do you think it is OK for all?
> 
> Regards,
> Yusuke
> 
> > Hi Yusuke
> > 
> > NOOPT is added for potentially large source files to reduce the compile time and memory usage.
> > 
> > I guess -D_FORTIFY_SOURCE option is added in your project Makefile or in your environment variable, instead of by 
> > ROME.
> > However, we could modify ROME to explicitly disable it by adding -D_FORTIFY_SOURCE=0 to NOOPT.
> > That can be done by modifying builder/src/ROMEBuildMakeFile.cpp line 1348.
> > 
> > Could you try to do it ?
> > 
> > Ryu
> > 
> > 
> > > Dear all,
> > > 
> > > Under the environment with GCC4.8.5 and ROOT6.08.04,
> > > we get the following warning messages when compiling XXXAnalyzer3, XXXAnalyzer4, 
> > > XXXConfig, XXXConfig2,3,4, XXXDBAccess, and XXXConfigToForm.
> > > 
> > > 
> > > In file included from /usr/include/stdlib.h:24:0,
> > >                  from /meg/data1/shared/mc/benchmark_test/rome3-root6.08.04-
> > > gcc485/include/ROMEAnalyzer.h:10,
> > >                  from include/generated/MEGPrecompile.h:23,
> > >                  from <command-line>:0:
> > > /usr/include/features.h:330:4: warning: #warning _FORTIFY_SOURCE requires compiling 
> > > with optimization (-O) [-Wcpp]
> > >  #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
> > >     ^
> > > [345/369] compiling obj/MEGAnalyzer4.o
> > > In file included from /usr/include/stdlib.h:24:0,
> > >                  from /meg/data1/shared/mc/benchmark_test/rome3-root6.08.04-
> > > gcc485/include/ROMEAnalyzer.h:10,
> > >                  from include/generated/MEGPrecompile.h:23,
> > >                  from <command-line>:0:
> > > /usr/include/features.h:330:4: warning: #warning _FORTIFY_SOURCE requires compiling 
> > > with optimization (-O) [-Wcpp]
> > >  #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
> > >     ^
> > > 
> > > It seems due to 'NOOPT' flag added to those objects in the Makefile.
> > > Is the 'NOOPT' flag necessary? If not, how can we remove it?
> > > 
> > > Regards,
> > > Yusuke
  85   01 Jun 2005 Ryu SawadaForumTaskHierarchy
This is a proposal on specifying relation of tasks.

Currently, ROME has task hierarchy system. It may be enough.
But a missing thing is that we can not use "||".

So a possibility is like this.

For example, there are two calibration tasks B and D, and a calculation task A requires one of B or D.
B and D dependes on data filling task C.

This case, one writes down the relation in definition file.
<TaskDependenses>
  <TaskDependense taskname="A"/> B || D </TaskDependense>
  <TaskDependense taskname="B"/> C </TaskDependense>
  <TaskDependense taskname="D"/> C && !B </TaskDependense>
</TaskDependeses>

Then, builder analyzes the relation and re-arranges the execution order like,
C->B->D->A

At run time, ROMEEventLoop checks if depending tasks were executed before calling a task. And when 
B or C is executed, it calls A.

This way users can specify complicated relation like ((A && B) || C ) || !D )....

A problem is that you can not express the relation with indent in configuration file and documentation.


This is just a proposal, I'm not sure which is better, TaskHierarcy or TaskDependense.
Personaly, I am not using task controll.
  99   08 Sep 2005 Ryu SawadaForumDividing xml the definition xml file.
I am thinking to divide my definition xml file into several files.

I do not know if there is a general way, but I found some web pages mentioning about it. According to 
these pages we can include an xml document to  other one like.

---------- booklist.xml ------------
<?xml version="1.0"?>
<!DOCTYPE books [
<!ENTITY book1 SYSTEM "book1.xml">
]>

<books>
  &book1;
</books>
------------------------------------
------------ book1.xml -------------
<?xml version="1.0"?>
<book>
  <title>Title of the book</title>
  <author>Author of the book</author>
</book>
------------------------------------

Is it possible to do it with mxml ?


I have two reasons.
1.
 I have two ROME programs.  I call them as "writer" and "reader" in this message. "reader" reads output 
file from "writer". In this case, "reader" needs to know the structure of branch folder defined in "writer"'s 
xml file.
What I am doing is adding headers of "writer" to DictionaryHeaders in Makefile.user of "reader". At least, 
it works, but this way I have to write reading function of trees by hand. On the other hand, If it is 
possible to include a part of xml file of "writer" in that of "reader", romebuilder can create proper 
functions automatically.

2.
 My project definition file is already big. It has more than 2000 lines. If one has good XML editor, it may 
not be a problem. But unfortunately I do not know good editor on Linux. What I am thinking is making a 
directory structure like this.
.
|-- main_definition.xml
`-- xml
    |-- folders
    |   |-- folder_1.xml
    |   |-- folder_2.xml
    |   `-- folder_3.xml
    `-- tasks
        |-- task_1.xml
        |-- task_2.xml
        `-- task_3.xml

folder_[1-3].xml and task_[1-3].xml will be included in main_definition.xml.
  100   06 Oct 2005 Ryu SawadaForumDividing xml the definition xml file.
> I am thinking to divide my definition xml file into several files.
> 
> I do not know if there is a general way, but I found some web pages mentioning about it. According to 
> these pages we can include an xml document to  other one like.
> 
> ---------- booklist.xml ------------
> <?xml version="1.0"?>
> <!DOCTYPE books [
> <!ENTITY book1 SYSTEM "book1.xml">
> ]>
> 
> <books>
>   &book1;
> </books>
> ------------------------------------
> ------------ book1.xml -------------
> <?xml version="1.0"?>
> <book>
>   <title>Title of the book</title>
>   <author>Author of the book</author>
> </book>
> ------------------------------------
> 
> Is it possible to do it with mxml ?

I made a patch to enable it with mxml.
Please test it.

If it is reliable, I will commit it.

----
cd $ROMESYS
patch -p0 < mxml.diff  
----
Attachment 1: mxml.diff
Index: include/mxml.h
===================================================================
RCS file: /usr/local/cvsroot/rome/include/mxml.h,v
retrieving revision 1.7
diff -u -r1.7 mxml.h
--- include/mxml.h	12 Jul 2005 09:04:15 -0000	1.7
+++ include/mxml.h	6 Oct 2005 21:53:13 -0000
@@ -43,6 +43,10 @@
 #define PROCESSING_INSTRUCTION_NODE   3
 #define COMMENT_NODE                  4
 #define DOCUMENT_NODE                 5
+#define ENTITY_NODE                   6
+
+#define INTERNAL_ENTITY               0
+#define EXTERNAL_ENTITY               1
 
 typedef struct {
    int  fh;
@@ -115,6 +119,7 @@
 PMXML_NODE mxml_create_root_node();
 PMXML_NODE mxml_parse_file(char *file_name, char *error, int error_size);
 PMXML_NODE mxml_parse_buffer(char *buffer, char *error, int error_size);
+PMXML_NODE mxml_parse_entity(char *buf, char *error, int error_size);
 int mxml_write_tree(char *file_name, PMXML_NODE tree);
 void mxml_debug_tree(PMXML_NODE tree, int level);
 void mxml_free_tree(PMXML_NODE tree);
Index: src/mxml.c
===================================================================
RCS file: /usr/local/cvsroot/rome/src/mxml.c,v
retrieving revision 1.8
diff -u -r1.8 mxml.c
--- src/mxml.c	11 May 2005 12:50:02 -0000	1.8
+++ src/mxml.c	6 Oct 2005 21:53:13 -0000
@@ -1209,6 +1209,30 @@
 
             p += 2;
 
+         } else if (strncmp(p, "!ENTITY", 7) == 0) {
+
+            /* found !ENTITY element */
+            pnew = mxml_add_special_node(ptree, ENTITY_NODE, "ENTYTY", NULL);
+            pv = p+1;
+
+            p++;
+            if (strstr(p, ">") == NULL)
+               return read_error(HERE, "Unterminated !ENTITY element");
+
+            while (*p != '>') {
+               if (*p == '\n')
+                  line_number++;
+               p++;
+            }
+
+            len = (size_t)p - (size_t)pv;
+            pnew->value = (char *)malloc(len+1);
+            memcpy(pnew->value, pv, len);
+            pnew->value[len] = 0;
+            mxml_decode(pnew->value);
+
+            p ++;
+
          } else {
             
             /* found normal element */
@@ -1407,6 +1431,249 @@
 
 /*------------------------------------------------------------------*/
 
+PMXML_NODE mxml_parse_entity(char *buf, char *error, int error_size)
+/* parse !ENTYTY entries of XML files and replace with references. Return NULL
+   in case of error, return error description. Optional file_name is used
+   for error reporting if called from mxml_parse_file() */
+{
+   char *p;
+   char *pv;
+   char delimiter;
+   int  i,j,k, line_number;
+   char replacement[1000];
+   char entity_name[256][256];
+   char entity_reference_name[256][256];
+   char *entity_value[256];
+   int  entity_type[256]; /* internal or external */
+   int  nentity;
+   int  fh, length,len;
+   char *buffer;
+   PMXML_NODE root = mxml_create_root_node(); // dummy for 'HERE'
+   char *file_name = NULL; // dummy for 'HERE'
+
+   /* copy string to temporary space */
+   buffer = (char *)malloc(strlen(buf)+1);
+   strcpy(buffer,buf);
+   free(buf);
+
+   p = buffer;
+   line_number = 1;
+   nentity = -1;
+
+   /* search !ENTITY */
+   do {
+      if (*p == '<') {
+
+         /* found new entity */
+         p++;
+         while (*p && isspace(*p)) {
+            if (*p == '\n')
+               line_number++;
+            p++;
+         }
+         if (!*p)
+            return read_error(HERE, "Unexpected end of file");
+
+         if (strncmp(p, "!ENTITY", 7) == 0) {
+
+            /* found entity */
+            nentity++;
+            if(nentity>=1000)
+               return read_error(HERE, "Too much entities");
+
+            pv = p+7;
+            while (*pv == ' ')
+               pv++;
+
+            /* extract entity name */
+            p = pv;
+
+            while (*p && isspace(*p) && *p != '<' && *p != '>') {
+               if (*p == '\n')
+                  line_number++;
+               p++;
+            }
+            if (!*p)
+               return read_error(HERE, "Unexpected end of file");
+            if (*p == '<' || *p == '>')
+               return read_error(HERE, "Unexpected \'%c\' inside !ENTITY", *p);
+
+            pv = p;
+            while (*pv && !isspace(*pv) && *pv != '<' && *pv != '>')
+               pv++;
+
+            if (!*pv)
+               return read_error(HERE, "Unexpected end of file");
+            if (*pv == '<'  || *pv == '>' )
+               return read_error(HERE, "Unexpected \'%c\' inside entity \"%s\"", *pv, &entity_name[nentity][1]);
+
+            len = (size_t)pv - (size_t)p;
+            if (len > (int)sizeof(replacement)-1)
+               len = sizeof(replacement)-1;
+            memcpy(replacement, p, len);
+            replacement[len] = 0;
+            mxml_decode(replacement);
+
+            entity_name[nentity][0] = '&';
+            i = 1;
+            entity_name[nentity][i] = 0;
+            while (*p && !isspace(*p) && *p != '/' && *p != '>' && *p != '<' && i<253)
+               entity_name[nentity][i++] = *p++;
+            entity_name[nentity][i++] = ';';
+            entity_name[nentity][i] = 0;
+
+            if (!*p)
+               return read_error(HERE, "Unexpected end of file");
+            if (*p == '<')
+               return read_error(HERE, "Unexpected \'<\' inside entity \"%s\"", &entity_name[nentity][1]);
+
+            /* extract replacement or SYSTEM*/
+            while (*p && isspace(*p)) {
+               if (*p == '\n')
+                  line_number++;
+               p++;
+            }
+            if (!*p)
+               return read_error(HERE, "Unexpected end of file");
+            if (*p == '>')
+               return read_error(HERE, "Unexpected \'>\' inside entity \"%s\"", &entity_name[nentity][1]);
+
+            /* check if SYSTEM */
+            if(strncmp(p, "SYSTEM", 6) == 0){
+               entity_type[nentity] = EXTERNAL_ENTITY;
+               p += 6;
+            }
+            else{
+               entity_type[nentity] = INTERNAL_ENTITY;
+            }
+
+            /* extract replacement */
+            while (*p && isspace(*p)) {
+               if (*p == '\n')
+                  line_number++;
+               p++;
+            }
+            if (!*p)
+               return read_error(HERE, "Unexpected end of file");
+            if (*p == '>')
+               return read_error(HERE, "Unexpected \'>\' inside entity \"%s\"", &entity_name[nentity][1]);
+
+            if (*p != '\"' && *p != '\'')
+               return read_error(HERE, "Replacement was not found for entity \"%s\"", &entity_name[nentity][1]);
+            delimiter = *p;
+            p++;
+            if (!*p)
+               return read_error(HERE, "Unexpected end of file");
+            pv = p;
+            while (*pv && *pv != delimiter )
+               pv++;
+
+            if (!*pv)
+               return read_error(HERE, "Unexpected end of file");
+            if (*pv == '<' )
+               return read_error(HERE, "Unexpected \'%c\' inside entity \"%s\"", *pv, &entity_name[nentity][1]);
+
+            len = (size_t)pv - (size_t)p;
+            if (len > (int)sizeof(replacement)-1)
+               len = sizeof(replacement)-1;
+            memcpy(replacement, p, len);
+            replacement[len] = 0;
+
+            if(entity_type[nentity] == EXTERNAL_ENTITY){
+               strcpy(entity_reference_name[nentity],replacement);
+            }
+            else{
+               entity_value[nentity] = (char *)malloc(strlen(replacement));
+               strcpy(entity_value[nentity],replacement);
+            }
+
+            p = pv;
+            while (*p && isspace(*p)) {
+               if (*p == '\n')
+                  line_number++;
+               p++;
+            }
+            if (!*p)
+               return read_error(HERE, "Unexpected end of file");
+         }
+      }
+
+      /* go to next element */
+      while (*p && *p != '<') {
+         if (*p == '\n')
+            line_number++;
+         p++;
+      }
+   } while (*p);
+   nentity++;
+
+   /* read external file */
+   for(i=0;i<nentity;i++){
+      if(entity_type[i] == EXTERNAL_ENTITY){
+         fh = open(entity_reference_name[i], O_RDONLY | O_TEXT, 0644);
+
+         if (fh == -1) {
+            return read_error(HERE, "Unable to open file \"%s\"",entity_reference_name[i]);
+         }
+
+         length = lseek(fh, 0, SEEK_END);
+         lseek(fh, 0, SEEK_SET);
+         entity_value[i] = (char *)malloc(length+1);
+         if (entity_value[i] == NULL) {
+            close(fh);
+            return read_error(HERE, "Cannot allocate buffer of %d bytes for \"%s\".",length+1,&entity_name[1]);
+         }
+
+         /* read complete file at once */
+         length = read(fh, entity_value[i], length);
+         entity_value[i][length] = 0;
+         close(fh);
+      }
+   }
+
+   /* count length of output string */
+   length = strlen(buffer);
+   for(i=0;i<nentity;i++){
+      p = buffer;
+      while(1){
+         pv =strstr(entity_name[i],p);
+         if(pv){
+            length += -strlen(entity_name[i]) + strlen(entity_value[i]);
+            p = pv+1;
+         }
+         else{
+            break;
+         }
+      }
+   }
+
+   /* allocate memory */
+   buf = (char *)malloc(length+1);
+
+   /* replace entities */
+   p = buffer;
+   pv = buf;
+   do {
+      if (*p == '&') {
+         /* found entity */
+         for(j=0;j<nentity;j++){
+            if(strncmp(p,entity_name[j],strlen(entity_name[j])) == 0){
+               for(k=0;k<(int)strlen(entity_value[j]);k++)
+                  *pv++ = entity_value[j][k];
+               p += strlen(entity_name[j]);
+               break;
+            }
... 27 more lines ...
  101   07 Oct 2005 Ryu SawadaForumDividing xml the definition xml file.
> I made a patch to enable it with mxml.
> Please test it.
> 
> If it is reliable, I will commit it.
> 
> ----
> cd $ROMESYS
> patch -p0 < mxml.diff  
> ----

I modified bugs, and commited.
Attachment 1: mxml.patch
? mxml.c
? mxml.h
? mxml.patch
? obj
? src/indent.txt
Index: include/mxml.h
===================================================================
RCS file: /usr/local/cvsroot/rome/include/mxml.h,v
retrieving revision 1.7
diff -u -r1.7 mxml.h
--- include/mxml.h	12 Jul 2005 09:04:15 -0000	1.7
+++ include/mxml.h	7 Oct 2005 13:15:53 -0000
@@ -43,6 +43,11 @@
 #define PROCESSING_INSTRUCTION_NODE   3
 #define COMMENT_NODE                  4
 #define DOCUMENT_NODE                 5
+#define ENTITY_NODE                   6
+
+#define INTERNAL_ENTITY               0
+#define EXTERNAL_ENTITY               1
+#define MXML_MAX_ENTITY            1000
 
 typedef struct {
    int  fh;
@@ -115,6 +120,7 @@
 PMXML_NODE mxml_create_root_node();
 PMXML_NODE mxml_parse_file(char *file_name, char *error, int error_size);
 PMXML_NODE mxml_parse_buffer(char *buffer, char *error, int error_size);
+PMXML_NODE mxml_parse_entity(char **buf, char *error, int error_size);
 int mxml_write_tree(char *file_name, PMXML_NODE tree);
 void mxml_debug_tree(PMXML_NODE tree, int level);
 void mxml_free_tree(PMXML_NODE tree);
Index: src/mxml.c
===================================================================
RCS file: /usr/local/cvsroot/rome/src/mxml.c,v
retrieving revision 1.8
diff -u -r1.8 mxml.c
--- src/mxml.c	11 May 2005 12:50:02 -0000	1.8
+++ src/mxml.c	7 Oct 2005 13:15:53 -0000
@@ -1209,6 +1209,30 @@
 
             p += 2;
 
+         } else if (strncmp(p, "!ENTITY", 7) == 0) {
+
+            /* found !ENTITY element */
+            pnew = mxml_add_special_node(ptree, ENTITY_NODE, "ENTYTY", NULL);
+            pv = p + 1;
+
+            p++;
+            if (strstr(p, ">") == NULL)
+               return read_error(HERE, "Unterminated !ENTITY element");
+
+            while (*p != '>') {
+               if (*p == '\n')
+                  line_number++;
+               p++;
+            }
+
+            len = (size_t)p - (size_t)pv;
+            pnew->value = (char *)malloc(len+1);
+            memcpy(pnew->value, pv, len);
+            pnew->value[len] = 0;
+            mxml_decode(pnew->value);
+
+            p ++;
+
          } else {
             
             /* found normal element */
@@ -1407,6 +1431,422 @@
 
 /*------------------------------------------------------------------*/
 
+PMXML_NODE mxml_parse_entity(char **buf, char *error, int error_size)
+/* parse !ENTYTY entries of XML files and replace with references. Return NULL
+   in case of error, return error description. Optional file_name is used
+   for error reporting if called from mxml_parse_file() */
+{
+   char *p;
+   char *pv;
+   char delimiter;
+   int i, j, k, line_number;
+   char *replacement;
+   char entity_name[MXML_MAX_ENTITY][256];
+   char entity_reference_name[MXML_MAX_ENTITY][256];
+   char *entity_value[MXML_MAX_ENTITY];
+   int entity_type[MXML_MAX_ENTITY];    /* internal or external */
+   int nentity;
+   int fh, length, len;
+   char *buffer;
+   PMXML_NODE root = mxml_create_root_node();   /* dummy for 'HERE' */
+   char *file_name = NULL;      /* dummy for 'HERE' */
+   int ip;                      /* counter for entity value */
+
+   for (ip = 0; ip < MXML_MAX_ENTITY; ip++)
+      entity_value[ip] = NULL;
+
+   line_number = 1;
+   nentity = -1;
+
+   /* copy string to temporary space */
+   buffer = (char *) malloc(strlen(*buf) + 1);
+   if (buffer == NULL) {
+      return read_error(HERE, "Cannot allocate memory.");
+   }
+
+   p = buffer;
+
+   strcpy(buffer, *buf);
+   free(*buf);
+
+   /* search !ENTITY */
+   do {
+      if (*p == '<') {
+
+         /* found new entity */
+         p++;
+         while (*p && isspace(*p)) {
+            if (*p == '\n')
+               line_number++;
+            p++;
+         }
+         if (!*p) {
+/*
+            free(buffer);
+            for(ip=0;ip<MXML_MAX_ENTITY;ip++)
+               free(entity_value[ip]);
+*/
+            return read_error(HERE, "Unexpected end of file");
+         }
+
+         if (strncmp(p, "!ENTITY", 7) == 0) {
+
+            /* found entity */
+            nentity++;
+            if (nentity >= MXML_MAX_ENTITY) {
+/*
+               free(buffer);
+               for(ip=0;ip<MXML_MAX_ENTITY;ip++)
+                  free(entity_value[ip]);
+*/
+               return read_error(HERE, "Too much entities");
+            }
+
+            pv = p + 7;
+            while (*pv == ' ')
+               pv++;
+
+            /* extract entity name */
+            p = pv;
+
+            while (*p && isspace(*p) && *p != '<' && *p != '>') {
+               if (*p == '\n')
+                  line_number++;
+               p++;
+            }
+            if (!*p) {
+/*
+               free(buffer);
+               for(ip=0;ip<MXML_MAX_ENTITY;ip++)
+                  free(entity_value[ip]);
+*/
+               return read_error(HERE, "Unexpected end of file");
+            }
+            if (*p == '<' || *p == '>') {
+/*
+               free(buffer);
+               for(ip=0;ip<MXML_MAX_ENTITY;ip++)
+                  free(entity_value[ip]);
+*/
+               return read_error(HERE, "Unexpected \'%c\' inside !ENTITY", *p);
+            }
+
+            pv = p;
+            while (*pv && !isspace(*pv) && *pv != '<' && *pv != '>')
+               pv++;
+
+            if (!*pv) {
+/*
+               free(buffer);
+               for(ip=0;ip<MXML_MAX_ENTITY;ip++)
+                  free(entity_value[ip]);
+*/
+               return read_error(HERE, "Unexpected end of file");
+            }
+            if (*pv == '<' || *pv == '>') {
+/*
+               free(buffer);
+               for(ip=0;ip<MXML_MAX_ENTITY;ip++)
+                  free(entity_value[ip]);
+*/
+               return read_error(HERE, "Unexpected \'%c\' inside entity \"%s\"", *pv,
+                                 &entity_name[nentity][1]);
+            }
+
+            len = (size_t) pv - (size_t) p;
+
+            entity_name[nentity][0] = '&';
+            i = 1;
+            entity_name[nentity][i] = 0;
+            while (*p && !isspace(*p) && *p != '/' && *p != '>' && *p != '<' && i < 253)
+               entity_name[nentity][i++] = *p++;
+            entity_name[nentity][i++] = ';';
+            entity_name[nentity][i] = 0;
+
+            if (!*p) {
+/*
+               free(buffer);
+               for(ip=0;ip<MXML_MAX_ENTITY;ip++)
+                  free(entity_value[ip]);
+*/
+               return read_error(HERE, "Unexpected end of file");
+            }
+            if (*p == '<') {
+/*
+               free(buffer);
+               for(ip=0;ip<MXML_MAX_ENTITY;ip++)
+                  free(entity_value[ip]);
+*/
+               return read_error(HERE, "Unexpected \'<\' inside entity \"%s\"", &entity_name[nentity][1]);
+            }
+
+            /* extract replacement or SYSTEM */
+            while (*p && isspace(*p)) {
+               if (*p == '\n')
+                  line_number++;
+               p++;
+            }
+            if (!*p) {
+/*
+               free(buffer);
+               for(ip=0;ip<MXML_MAX_ENTITY;ip++)
+                  free(entity_value[ip]);
+*/
+               return read_error(HERE, "Unexpected end of file");
+            }
+            if (*p == '>') {
+/*
+               free(buffer);
+               for(ip=0;ip<MXML_MAX_ENTITY;ip++)
+                  free(entity_value[ip]);
+*/
+               return read_error(HERE, "Unexpected \'>\' inside entity \"%s\"", &entity_name[nentity][1]);
+            }
+
+            /* check if SYSTEM */
+            if (strncmp(p, "SYSTEM", 6) == 0) {
+               entity_type[nentity] = EXTERNAL_ENTITY;
+               p += 6;
+            } else {
+               entity_type[nentity] = INTERNAL_ENTITY;
+            }
+
+            /* extract replacement */
+            while (*p && isspace(*p)) {
+               if (*p == '\n')
+                  line_number++;
+               p++;
+            }
+            if (!*p) {
+/*
+               free(buffer);
+               for(ip=0;ip<MXML_MAX_ENTITY;ip++)
+                  free(entity_value[ip]);
+*/
+               return read_error(HERE, "Unexpected end of file");
+            }
+            if (*p == '>') {
+/*
+               free(buffer);
+               for(ip=0;ip<MXML_MAX_ENTITY;ip++)
+                  free(entity_value[ip]);
+*/
+               return read_error(HERE, "Unexpected \'>\' inside entity \"%s\"", &entity_name[nentity][1]);
+            }
+
+            if (*p != '\"' && *p != '\'') {
+/*
+               free(buffer);
+               for(ip=0;ip<MXML_MAX_ENTITY;ip++)
+                  free(entity_value[ip]);
+*/
+               return read_error(HERE, "Replacement was not found for entity \"%s\"",
+                                 &entity_name[nentity][1]);
+            }
+            delimiter = *p;
+            p++;
+            if (!*p) {
+/*
+               free(buffer);
+               for(ip=0;ip<MXML_MAX_ENTITY;ip++)
+                  free(entity_value[ip]);
+*/
+               return read_error(HERE, "Unexpected end of file");
+            }
+            pv = p;
+            while (*pv && *pv != delimiter)
+               pv++;
+
... 207 more lines ...
  107   06 Jan 2006 Steven SheetsForumTNetFolder.h
I just downloaded ROME v 2.0, I think. After running the make file I try and use romebuilder.exe
on the example stepbystep given in the download. When running romebuilder.exe
on stepbystep.xml I found it could not locate the file TNetFolder.h.

I googled this file and found a version of it which I copied to rome/include but still the builder will not build the analyzer. At this point I'm not sure how to get around this problem. If you have suggestions I'd appreciate it.

thanks,
Steven Sheets
  108   06 Jan 2006 Ryu SawadaForumTNetFolder.h
You can download the latest TNetFolder.h from the repository with web browser.

http://savannah.psi.ch/websvn/listing.php?repname=rome&path=%2Ftrunk%2Frome%2F&rev=0&sc=0


TNetFolder.h was added to "rome/include" in two weeks ago. Please make sure you have recent version.
If your copy is old, please update your copy with "svn update" command.


If the problem is not still fixed, could you paste error message from compiler ?
  126   29 Jun 2006 Steven SheetsForumROME analyzer crashes on reading midas file.
Hello,

So I'm stuck on this problem. The ROME based analyzer I use crashes everytime it attempts to open a midas file giving me this error:

Reading Midas-File /home/sheets4/run04750.mid.gz

*** Break *** segmentation violation
Generating stack trace...
0x00002b93efa9cd5c in gzread + 0xfc from /home/sheets4/root/lib/libCore.so
0x00000000004c47d9 in ROMEMidasDAQ::Event(long long) + 0x165 from ./danceanalyzer.exe
0x00000000004c452e in ROMEMidasDAQ::BeginOfRun() + 0x534 from ./danceanalyzer.exe
0x00000000004bf3da in ROMEDAQSystem::BeginOfRunDAQ() + 0x32 from ./danceanalyzer.exe
0x00000000004c1555 in ROMEEventLoop::DAQBeginOfRun(long long) + 0x15d from ./danceanalyzer.exe
0x00000000004c0721 in ROMEEventLoop::ExecuteTask(char const*) + 0x2d5 from ./danceanalyzer.exe
0x00000000004bb395 in ROMEAnalyzer::Start(int, char**) + 0x35d from ./danceanalyzer.exe
0x00000000005d121d in main + 0x2b1 from ./danceanalyzer.exe
0x000000363331c4bb in __libc_start_main + 0xdb from /lib64/tls/libc.so.6
0x00000000004b2e1a in TApplicationImp::ShowMembers(TMemberInspector&, char*) + 0x82 from ./danceanalyzer.exe
Aborted


I'd guess the problem is connected with ROOT but I'm not sure how to fix it.

I run ROOT v5.10.00
ROME v2.4
on a machine with Dual AMD opterons, 64 Bit with Red Hat Enterprise.

Any help would be appreciated.

thanks,
Steven
  127   04 Jul 2006 Matthias SchneebeliForumROME analyzer crashes on reading midas file.
From the error message I don't see where the problem is.
Are you sure that your midas file is ok?

You can send me the xml definition file, all source files of your project and the midas file. Then I will take a look at it.

Matthias




Steven Sheets wrote:
Hello,

So I'm stuck on this problem. The ROME based analyzer I use crashes everytime it attempts to open a midas file giving me this error:

Reading Midas-File /home/sheets4/run04750.mid.gz

*** Break *** segmentation violation
Generating stack trace...
0x00002b93efa9cd5c in gzread + 0xfc from /home/sheets4/root/lib/libCore.so
0x00000000004c47d9 in ROMEMidasDAQ::Event(long long) + 0x165 from ./danceanalyzer.exe
0x00000000004c452e in ROMEMidasDAQ::BeginOfRun() + 0x534 from ./danceanalyzer.exe
0x00000000004bf3da in ROMEDAQSystem::BeginOfRunDAQ() + 0x32 from ./danceanalyzer.exe
0x00000000004c1555 in ROMEEventLoop::DAQBeginOfRun(long long) + 0x15d from ./danceanalyzer.exe
0x00000000004c0721 in ROMEEventLoop::ExecuteTask(char const*) + 0x2d5 from ./danceanalyzer.exe
0x00000000004bb395 in ROMEAnalyzer::Start(int, char**) + 0x35d from ./danceanalyzer.exe
0x00000000005d121d in main + 0x2b1 from ./danceanalyzer.exe
0x000000363331c4bb in __libc_start_main + 0xdb from /lib64/tls/libc.so.6
0x00000000004b2e1a in TApplicationImp::ShowMembers(TMemberInspector&, char*) + 0x82 from ./danceanalyzer.exe
Aborted


I'd guess the problem is connected with ROOT but I'm not sure how to fix it.

I run ROOT v5.10.00
ROME v2.4
on a machine with Dual AMD opterons, 64 Bit with Red Hat Enterprise.

Any help would be appreciated.

thanks,
Steven
ELOG V3.1.4-2e1708b5