Back Midas Rome Roody Rootana
  Rome Analyzer Framework, Page 3 of 11  Not logged in ELOG logo
ID Date Author Topic Subjectup
  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
  71   09 Apr 2005 Daniele BarbareschiBug ReportCompiling Builder
I am Daniele Barbareschi, I am a Corrado Gatto's student 
I work to interfacing between ALIROOT and MYSQL for CONSTANT CALIBRATION of 
subdetector.

There's a bug in compiling...

NAME of file "ROMEXML.h,ROMEXML.cpp" in the ultimate version ROME is lowercase.
The gmake program return error.

Maybe ROMESQL too.
See you those files and similar.

D.B.
  109   09 Jan 2006 Ryu SawadaSuggestionConfiguration file
About configuration XML files.

Now we merged ROME and ARGUS.
So I expect that users often have several configuration files for one project.

But I realized many people don't know that they can specify configuration file.

So I propose following scheme.

* When a program starts, it searches all XML files located in current directory which has <Configuration> tag at the top.
* If it does not find any XML file, it asks user to generate new one.
   * ask configuration type [R/A/M/N]
   * ask filename. Default is romeConfig.xml
* If it find only one XML file, it reads the XML file.
* If it find several XML files, it asks user which file should be used with a prompt like,
     Which configuration file do you use ?
      [1] filename1.xml
      [2] romeConfig.xml
      [3] filename2.xml
      [q] quit program
* When user starts program with option -c, it asks creates new configuration anyway.
* When user starts program with option -i, it uses specified file.
  111   13 Jan 2006 Ryu SawadaSuggestionConfiguration file
done.
Program searches configuration XML file in ./ and ./config
  Draft   28 Feb 2018 Francesco RengaForumDB path
Dear all,
           I need to perform a DB query in ROME, where I have to select an array of 
  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 ...
  174   03 Dec 2015 SUDESHNA GANGULYSuggestionDrawing multiple histograms on the same pad and dispalying them in the online mode in ROME
I need some suggestions regarding drawing multiple histograms on the same pad in
ROME.
Here is what I have been doing.  I am making a summary histogram online dispaly
with ARGUS. The displays is gonna show multiple different types of histograms. 

So I made a module with four different types of histograms all on the same canvas,
so that I can look at them in real time in an online run.

Now in one of the histograms, I am looping over multiple banks, so in one of the
pads, I want to see two different lines of different colors (to indicate two
different histograms of the same type from two banks). 
So I used histoGUI.xml (from examples/histoGUI) and used this way of histogram
and tab declarations:
  <Tasks>
                <Task>
                        <TaskName>FillHisto</TaskName>
        <Histogram>
                                <HistName>h1_Esum</HistName>


                                <HistArraySize>2</HistArraySize>
                                <HistFolderName>myhistos</HistFolderName>
                                <HistType>TH1F</HistType>

                                <HistXLabel>ESum</HistXLabel>
                                <HistYLabel>Entries</HistYLabel>
                                <HistXNbins>300</HistXNbins>
                                <HistXmin>0</HistXmin>
                                <HistXmax>3.1</HistXmax>
</Histogram>               




<Histogram>
                                <HistName>h1_amplitude</HistName>
                                <HistFolderName>myotherhistos</HistFolderName>
                                 <HistArraySize>108</HistArraySize>


                                <HistType>TH1F</HistType>
                                <HistXLabel>Amplitude</HistXLabel>
                                <HistYLabel>Entries</HistYLabel>
                                <HistXNbins>4096</HistXNbins>
                                <HistXmin>-0.5</HistXmin>
                                <HistXmax>4095.5</HistXmax>
                                <Argus>
                                        <Tab>
                                                <TabName>GeneratedHisto</TabName>
                                              
<ObjectArrayIndex>0</ObjectArrayIndex>

                                                <Index>1</Index>
                                        </Tab>
                                </Argus>
                        </Histogram>

etc. and two other histograms have been defined in the same way.

And then in the src/task: HGUITFillHisto.cpp
I added this: (to draw two histograms on the same pad)

          if(icalo==1)
            {
          Geth1_EsumAt(0)->Fill(0.00009118*sum);

          Geth1_EsumAt(0)->SetLineColor(3);

             }

          Geth1_EsumAt(0)->Draw();

          if(icalo==2)
            {
          Geth1_EsumAt(1)->Fill(0.00009118*sum);

            }

          Geth1_EsumAt(1)->Draw("same");

And attached is the screen shot from ARGUS.

Now the problem is: when I add the Draw() and Draw("same") codes in the src/task
code, it always creates two copies of the same pad. The 0th pad and the very last
pad. So what ever is on the last pad in the attachment is being replaced by the
same copy of the 0th pad. I kept chaning the Index number in histoGUI.xml, but what
ever I do, if I try to draw two histograms on the same pad and add those codes in
the srdc/task .cpp file, it always creates two copies.

I don't know where to look at to fix the problem.

Is there any other way I can add multiple histograms on a pad, while keeping the
other pads on the canvas intact?

Any help on this issue will be much appreciated.
Attachment 1: Screenshot-11.png
Screenshot-11.png
  175   07 Dec 2015 Ryu SawadaSuggestionDrawing multiple histograms on the same pad and dispalying them in the online mode in ROME
Hello,

First of all, the histograms are supposed to be drawn by the automatically generated code.

You don't need (and should not) draw them from a task.
If you do so, the histograms are drawn on the active pad (gPad) which is, in your case, the last pad on a tab.


I added a new feature to ROME development branch.
For using the feature, you can try
 cd $ROMESYS
 git checkout develop
 git pull
 make
 cd your_project
 make build
 make

As you can see in the updated examples/histoGUI/histoGUI.xml, a new option <DrawSamePad>true</DrawSamePad> is 
available.
When it is true, the array of histograms are drawn on the same pad.

If you have any problems, please let me know.

Best regards,

Ryu


> I need some suggestions regarding drawing multiple histograms on the same pad in
> ROME.
> Here is what I have been doing.  I am making a summary histogram online dispaly
> with ARGUS. The displays is gonna show multiple different types of histograms. 
> 
> So I made a module with four different types of histograms all on the same canvas,
> so that I can look at them in real time in an online run.
> 
> Now in one of the histograms, I am looping over multiple banks, so in one of the
> pads, I want to see two different lines of different colors (to indicate two
> different histograms of the same type from two banks). 
> So I used histoGUI.xml (from examples/histoGUI) and used this way of histogram
> and tab declarations:
>   <Tasks>
>                 <Task>
>                         <TaskName>FillHisto</TaskName>
>         <Histogram>
>                                 <HistName>h1_Esum</HistName>
> 
> 
>                                 <HistArraySize>2</HistArraySize>
>                                 <HistFolderName>myhistos</HistFolderName>
>                                 <HistType>TH1F</HistType>
> 
>                                 <HistXLabel>ESum</HistXLabel>
>                                 <HistYLabel>Entries</HistYLabel>
>                                 <HistXNbins>300</HistXNbins>
>                                 <HistXmin>0</HistXmin>
>                                 <HistXmax>3.1</HistXmax>
> </Histogram>               
> 
> 
> 
> 
> <Histogram>
>                                 <HistName>h1_amplitude</HistName>
>                                 <HistFolderName>myotherhistos</HistFolderName>
>                                  <HistArraySize>108</HistArraySize>
> 
> 
>                                 <HistType>TH1F</HistType>
>                                 <HistXLabel>Amplitude</HistXLabel>
>                                 <HistYLabel>Entries</HistYLabel>
>                                 <HistXNbins>4096</HistXNbins>
>                                 <HistXmin>-0.5</HistXmin>
>                                 <HistXmax>4095.5</HistXmax>
>                                 <Argus>
>                                         <Tab>
>                                                 <TabName>GeneratedHisto</TabName>
>                                               
> <ObjectArrayIndex>0</ObjectArrayIndex>
> 
>                                                 <Index>1</Index>
>                                         </Tab>
>                                 </Argus>
>                         </Histogram>
> 
> etc. and two other histograms have been defined in the same way.
> 
> And then in the src/task: HGUITFillHisto.cpp
> I added this: (to draw two histograms on the same pad)
> 
>           if(icalo==1)
>             {
>           Geth1_EsumAt(0)->Fill(0.00009118*sum);
> 
>           Geth1_EsumAt(0)->SetLineColor(3);
> 
>              }
> 
>           Geth1_EsumAt(0)->Draw();
> 
>           if(icalo==2)
>             {
>           Geth1_EsumAt(1)->Fill(0.00009118*sum);
> 
>             }
> 
>           Geth1_EsumAt(1)->Draw("same");
> 
> And attached is the screen shot from ARGUS.
> 
> Now the problem is: when I add the Draw() and Draw("same") codes in the src/task
> code, it always creates two copies of the same pad. The 0th pad and the very last
> pad. So what ever is on the last pad in the attachment is being replaced by the
> same copy of the 0th pad. I kept chaning the Index number in histoGUI.xml, but what
> ever I do, if I try to draw two histograms on the same pad and add those codes in
> the srdc/task .cpp file, it always creates two copies.
> 
> I don't know where to look at to fix the problem.
> 
> Is there any other way I can add multiple histograms on a pad, while keeping the
> other pads on the canvas intact?
> 
> Any help on this issue will be much appreciated.
  130   20 Feb 2007 Todd Bredeweg Duplicate header file
I just started using Rome v2.7 and Root v5.14.00. I have run into a rather
interesting issue trying to compile my analyzer. I tracked the problem to the
fact that both Root and Rome are loading their own version of a header file
called TArrayL64.h. The content of the two files are essentially identical. I
solved the problem by changing the conditional at the start of the file
$ROMESYS/include/TArrayL64.h from

#ifndef TArrayL64_H
#define TArrayL64_H

to

#ifndef ROOT_TArrayL64
#define ROOT_TArrayL64

The latter is what I found in the Root version of the file. Now it only gets
loaded once. I looked at the svn sources that I just updated and it also uses
TArrayL64_H.

Question, why are there two copies.

UPDATE 2-21-07:
It seems that Root was the cause of this. Rome has used this header for some
time, but earlier versions of Root did not include it.
  131   23 Feb 2007 Matthias SchneebeliForumDuplicate header file
> I just started using Rome v2.7 and Root v5.14.00. I have run into a rather
> interesting issue trying to compile my analyzer. I tracked the problem to the
> fact that both Root and Rome are loading their own version of a header file
> called TArrayL64.h. The content of the two files are essentially identical. I
> solved the problem by changing the conditional at the start of the file
> $ROMESYS/include/TArrayL64.h from
> 
> #ifndef TArrayL64_H
> #define TArrayL64_H
> 
> to
> 
> #ifndef ROOT_TArrayL64
> #define ROOT_TArrayL64
> 
> The latter is what I found in the Root version of the file. Now it only gets
> loaded once. I looked at the svn sources that I just updated and it also uses
> TArrayL64_H.
> 
> Question, why are there two copies.
> 
> UPDATE 2-21-07:
> It seems that Root was the cause of this. Rome has used this header for some
> time, but earlier versions of Root did not include it.


As you already mentioned the older root version didn't include this header. But we
needed to include it in rome earlier. Now we still have it in the rome
distribution to be compatible with the older root versions.

There should not be any problem with this header in the current rome version. If
you have compilation problems do a  make distclean  and try again.
  132   23 Feb 2007 Konstantin OlchanskiForumDuplicate header file
> > I just started using Rome v2.7 and Root v5.14.00. I have run into a rather
> > interesting issue trying to compile my analyzer. I tracked the problem to the
> > fact that both Root and Rome are loading their own version of a header file
> > called TArrayL64.h.

I have just run into the TArrayL64.h problem myself. I recommend that we resolve
the clashing header files. We could ask Rene Brun to rename his file or we could
rename the clashing file in Rome.

K.O.
  133   28 Feb 2007 Ryu SawadaForumDuplicate header file
> > > I just started using Rome v2.7 and Root v5.14.00. I have run into a rather
> > > interesting issue trying to compile my analyzer. I tracked the problem to the
> > > fact that both Root and Rome are loading their own version of a header file
> > > called TArrayL64.h.
> 
> I have just run into the TArrayL64.h problem myself. I recommend that we resolve
> the clashing header files. We could ask Rene Brun to rename his file or we could
> rename the clashing file in Rome.
> 
> K.O.

As Matthias mensioned, this problem is solved in SVN version of ROME.
I propose to release ROME version 2.8, which will not have this problem.

If there are users who want to continue to use 2.7, we could also release patch release of 2.7. (2.7.1), in which only compatibility problems 
are fixed.

Ryu
  134   28 Feb 2007 Ryu SawadaForumDuplicate header file
> > > > I just started using Rome v2.7 and Root v5.14.00. I have run into a rather
> > > > interesting issue trying to compile my analyzer. I tracked the problem to the
> > > > fact that both Root and Rome are loading their own version of a header file
> > > > called TArrayL64.h.
> > 
> > I have just run into the TArrayL64.h problem myself. I recommend that we resolve
> > the clashing header files. We could ask Rene Brun to rename his file or we could
> > rename the clashing file in Rome.
> > 
> > K.O.
> 
> As Matthias mensioned, this problem is solved in SVN version of ROME.
> I propose to release ROME version 2.8, which will not have this problem.
> 
> If there are users who want to continue to use 2.7, we could also release patch release of 2.7. (2.7.1), in which only compatibility problems 
> are fixed.

I prepared a new release 2.8. It can be downloaded from http://midas.psi.ch/rome/download.html

The new release works with also ROOT 5.14 or 5.15.

At this release, style of configuration file was changed. Please see following message for details. 
https://ladd00.triumf.ca/elog/Rome/129
  198   13 Apr 2016 SUDESHNA GANGULYBug ReportError with maximum number of tabs in Argus section
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
  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
ELOG V3.1.4-2e1708b5