#fix-#unfix

Enclosing portions of a config file within #fix-#unfix (alternate forms: #freeze-#unfreeze) preprocessor directives has the effect of fixing (freezing) those sections of the file, thereby preventing comment elimination and macro expansion.  You can fix individual lines, stanzas, or even entire files in this way.

For example, in macros.cfg, you might use #fix-#unfix in this way:

// a filter to render, e.g., 'perl foo.pl' as simply 'foo.pl' in a ps display

#fix
zapinterpreters /bin/sed 's/.usr.bin.perl //' | /bin/sed 's/perl //' |
                /bin/sed\ 's/.usr.bin.python //' | /bin/sed 's/python //' |
                /bin/sed 's/.bin.bash //' | \/bin/sed 's/bash //' |
                /bin/sed 's/.bin.sh -c //'
#unfix
Without the #fix-#unfix, the first '//' would be interpreted as a comment marker, and the line would process to:
zapinterpreters /bin/sed 's/.usr.bin.perl
As another example, we use PIKT as a content management system (CMS) for the PIKT Reference. In the PIKT configuration files for these web pages, we use #fix-#unfix retain the comment markers '//...', as in:
<pre>
#fix
///////////////////////////////////////////////////////////////////////////////
//
// files_system_suse_linux_objects.cfg
//
///////////////////////////////////////////////////////////////////////////////
#unfix

...
</pre>
Without the #fix-#unfix, the file header above would be entirely commented out in the installed web page.

As a final example, in the spell_check_programs.cfg file, we suppress the commenting out in this Perl script line:

#fix
	        $word =~ s/\s//g;       # remove spaces
#unfix
Without the #fix-#unfix, the installed script would have the line:
	        $word =~ s/\s
Note that, instead of using #fix-#unfix, you could suppress commenting out by backslash escaping the '//':
	        $word =~ s/\s\/\/g;       # remove spaces
In the first example above, dispensing with #fix-#unfix, one could instead do long lines of this:
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/...

In many cases, however, it is much cleaner, more readable, and more concise to use #fix-#unfix instead of the backslash escape.

(Note that in certain situations, one could also achieve the same effect of #fix-#unfix by means of the #verbatim directive.)

Refer to the Samples section for more examples.

prev page 1st page next page
 
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2019-01-12.   This site is PIKT® powered.
Copyright © 1998-2019 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
View sample
high user
process counts
Pikt script