EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
<== Date ==> <== Thread ==>

Subject: Macro max size is 256
From: TZVETKOV Stephane via Tech-talk <tech-talk at aps.anl.gov>
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Fri, 7 Jul 2023 09:49:21 +0000
Hi everyone,

I'd like to share my observation about the maximum size of a macro.

I was working on an IOC with a record similar to the one below:
```
record(waveform,"my:test:waveform") {
    field(FTVL, "CHAR")
    field(NELM, 1024)
    field(INP, { const: "${A_MACRO_CONTAINING_A_VERY_VERY_LONG_STRING}" } )
}
```

I somehow found out that the associated NORD field was always limited to 256, and that my string was always cropped to 256 characters. It took me some time to actually understand that the limitation was that an EPICS macro has a maximum size of 256 characters. E.g., the below record would not have such problem:
```
record(waveform,"my:test:waveform") {
    field(FTVL, "CHAR")
    field(NELM, 1024)
    field(INP, { const: "a plain text very long string, containing more than 256 characters, not in a macro..." } )
}
```

(by the way, I also discovered that the name of a macro is also limited to 256 characters)

In order to work around this limitation, I just recompiled the EPICS base with a minor modification in `modules/libcom/src/macLib/macLib.h`. E.g., changing the maximum size from 256 to 65535:
```
vi modules/libcom/src/macLib/macLib.h
        > ...
     ~ > #define MAC_SIZE 65535
        > ...
```

As far as I have tested, this modification didn't seem to cause any problem. But, I wonder if more experienced EPICS developers have comments about this. Maybe increasing macro size has side effects that I didn't anticipated. Maybe there is a cleaner/better way to do this.

I'd like to hear your feedbacks, if any.

I didn't found a lot of documentation/examples on the subject, so I hope that this tech-talk message will help future readers for troubleshooting this kind of issue.

Special thanks to Rémi NICOLE for his help.

Cheers,

Stéphane Tzvetkov
CEA Saclay – DRF / IRFU / DIS / LDISC


Replies:
Re: Macro max size is 256 Andrew Johnson via Tech-talk

Navigate by Date:
Prev: Re: interrupt read data in int32Driver example Ralph Lange via Tech-talk
Next: Re: issue of getTimeStamp from EVR Timo Korhonen via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
Navigate by Thread:
Prev: Re: issue of getTimeStamp from EVR Ralph Lange via Tech-talk
Next: Re: Macro max size is 256 Andrew Johnson via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
ANJ, 07 Jul 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·