FILE ... TOC

Generating output code

If you use extensive commenting in an interpretive language like Perl, and your program runs many times the intrerpretation phase slow-down caused by the comments can result significant performance degradation.

In other situation you might have a language that does not allow comments at all.

In such situations you can use esd2html converter to generate version of your script that is compact, does not include unneccessary formatting and comment.

If you define CodeRoot in the SDD file the program will copy each script to the directory performing several conversions during the copy.

First of all only the lines that are not processed as esd comment will be copied. All lines that should be skipped will be skipped and each line will be converted using the commands given in the SDD file.

The string defined in the SDD file using the keyword PreprocessLine will be evaluated for each line which does not belong to the esd comments. The string is evaluated as a Perl command, while the source line is in $_. If there are more than one PreprocessLine string defined each will be evaluated in the order they are specified in the SDD file.

The keyword StripLine defines Perl commands to decide whether a line should be stripped off the script or not. You can define many StripLine commands. They will be evaluated in the order they are specified. If any of them is found true the rest of the StripLine commands will be skipped together with the source line. Note that the StripLine string are evaluated the same way as PreprocessLine strings and can therefore modify the output line modifying the Perl variable $_.

Here are some sample PreprocessLine and StripLine strings with explanations:

PreprocessLine = 's/^\s*//'                   delete spaces from front of each line
PreprocessLine = 's/\s*$//'                   delete trailing spaces
StripLine = '/^\s*#/'                         skip Perl comments
StripLine = '/^\s*REM\s+/i'                   skip non empty BASIC comments
StripLine = '/^\s*REM$/i'                     skip empty BASIC comments
StripLine = '/^\s*$/'                         skip empty lines

FILE ... TOC