Skip to main content

The M4 macro system

Bravura Security Fabric uses an off-the-shelf text macro system called M4 to construct the Legacy skin files. m4 expands short strings (macros) into longer strings.

An M4 macro processor is shipped with Bravura Security Fabric.m4 was made popular on Unix systems as a way to manage sendmail configuration files more easily. For more information about M4, visit: http://www.gnu.org/software/m4/.

An M4 file may consist of:

  • An initialization block

  • Tag values

  • An ending block

  • Comments

Initialization block

The initialization block is a series of statements specific to the m4 language. It includes all statements up to but not including the first line that starts with !!!.

For example, psf.m4 begins with:

define(‘PSFMODULE', ‘yes')
include(initialize.m4)
include(common.m4)
include(errors.m4)
!!!F_LOGIN_HIDDEN_TAG
<input type="hidden" name="%HIDDEN_NAME%" value="%HIDDEN_VALUE%" />
!!!F_HEALTH_CHECKS
  _PSF_HEALTH_CHECKS_DESC

Tag values

All tag values start with three exclamation marks. They include all statements up to, but not including, the next line that starts with !!!.

The tag body can include:

  • Statements specific to m4 (define statements)

  • Bravura Security Fabric -specific macros or tags

    (example: _PSF_HEALTH_CHECKS_DESC)

    When you run make.bat, the m4 program expands these tags.

  • HTML markup (example: <p class="bold"> … </p> )

  • Dynamic-text place holders (example: %HIDDEN_NAME% )

    At run-time, Bravura Security Fabric replaces these strings with session-specific data.

Some tag bodies will include widget definitions. When a page is loaded the CGI will use widget files to interpret these to statements into HTML markup with the attributes from the definition.

For example:

!!!F_OPTION_USER_MENU
<!--@div( class="hide" id="userMenu" )-->
  <!--@rawhtml()-->%USERMENU%<!--@endrawhtml()-->
<!--@enddiv()-->

In this example the tag body includes two widget definitions; div and rawhtml. A widget definition can be broken down as follows:

  • The ’begin’ widget file (if it exists) that will be used to interpret this definition. <!--@div indicates that the div-begin.html file will be used to interpret.

  • The HTML attribute definitions. ( class="hide" id="userMenu" )

  • The content for the widget (if needed). In the example the content of the div is the rawhtml widget definition and the content of the rawhtml is %USERMENU%

  • The ’end’ widget file (if it exists) that will be used to interpret this definition. <!--@enddiv indicates that the div-end.html file will be used to interpret.

Ending block

The ending block is a set of zero or more m4-specific statements that appear at the end of the file. For example:

sinclude(custom/psf.m4)

Comments

A comment is any line beginning in dnl.