[liblouis-liblouisxml] Introducing the liblouisutdml macro feature

  • From: "John J. Boyer" <john.boyer@xxxxxxxxxxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Wed, 25 Apr 2012 10:45:55 -0500

This feature will be available soon. I'm writing the code for it now. 
You can see it in the semantics.c module. Look for "beginning macro 
processing". Please do not change anything. The code is not yet complete 
and the feature cannot yet be used. When it is activated it will not 
affect the operation of the library unless it is invoked. Of course,when 
you do invoke it you'll have to expect bugs. Thanks for testing!

Below is a first draft of the documentation for the macro feature. It 
will be a new section in the liblouisutdml manual.

--------------------

Using Macros

A semantic-action file permits only one action or style to be mentioned 
in the first column. Macros get around this limitation. They define a 
style and a series of semantic actions. A macro name can also be in the 
first column. 

Macros somewhat resemble styles. They are defined in a configuration 
file and used  in a semantic-action file. In a configuration file the 
definition is of the form

macro macroName macroBody 

In a semantic-action file they are invoked as follows:

macroName element[,attribute[,value]] [parameters] 

Here is an example of a macro definition.

macro useSpanish para,configtweak(literaryTextTable=es-Es-g2.ctb)

In a semantic-action file it might be used as follows.

useSpanish p,lang,es

The meanings of the various parts of a macro are as follows:

macroName: is a string of alphanumeric characters, of which the first 
must be a letter.

macroBody: is a series of items separated by commas. It may not contain 
whitespace. If it is too long to fit on one line it may be continued 
by using a backslash (\) followed by enter. It should not be more 
than 500 characters in length. Each item is one of the following:

A style name: Only one style can be specified in a macro. This is due to 
the way in which styles are handled.

A semantic action, optionally with parameters: The parameters are 
enclosed in parentheses. They consist of whatever is legal in the third 
column for the particular semantic action. If the parentheses are empty, 
that is, simply () the contents of the third column of the macro 
invocation itself are used as the parameters.

The word pause: This is used after a style name so that text belonging 
to that style can be processed. Semantic actions can be specified 
between the style name and this word. 

The word endstyle: This causes the style to be terminated and the 
processing of any text which may have been entered into it to be 
completed. Semantic actions may be specified after this word.

If a style has been specified and neither pause nor endstyle has been 
used the style is terminated when the end of the macro has been reached, 
and the processing of text is completed. (When the end_macro function is 
called by the program.)



-- 
John J. Boyer; President, Chief Software Developer
Abilitiessoft, Inc.
http://www.abilitiessoft.com
Madison, Wisconsin USA
Developing software for people with disabilities

For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com

Other related posts:

  • » [liblouis-liblouisxml] Introducing the liblouisutdml macro feature - John J. Boyer