P4

p4 is the Perl based macro processor.
Download

P4 Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Price:
  • FREE
  • Publisher Name:
  • James Klicman
  • Publisher web site:
  • http://klicman.org/p4/

P4 Tags


P4 Description

p4 is the Perl based macro processor. p4 is the Perl based macro processor.When cpp and m4 are insufficient, there is p4. New, with the power of Perl.p4 has two macro prefix characters $ and &. You can escape these characters with a backslash to prevent macro expansion (e.g. $ and &). The character will be removed in the output. Generally speaking, $ is usedfor getting values, & is used to eval code. &() returns a value, where as &{} does not.There is currently only one builtin macro &include().&include("hello.p4")$who=$whoYou can define new macro functions.&{ sub who { return $_ || $who; }}&who=&who&who("me")=&who("me")Hello &who&{$foo = 'bar'}Example of how multiple characters are handled for $ and &.$foo=$foo$foo=$foo$foo=$fooYou can enclose macros in braces.${foo}z=${foo}z&($foo)=&($foo)&(length($foo))=&(length($foo))You can address arrays and hashes.&{@var = ('a','b','c')}$var=$var${var}=${var}&($var)=&($var)&{ $map{'one'} = 1; $map{'two'} = 2; $map{'2'} = 'two'; $map{'three'} = 3;}$map{'one'}=$map{'one'}${map{'two'}}=${map{'two'}}${map{$map{'two'}}}=${map{$map{'two'}}}${map{$map{'2'}}}=${map{$map{'2'}}}&($map{'three'})=&($map{'three'})Usage: p4 file.p4 >outputRequirements:· PerlWhat's New in This Release:· Added anonymous function syntax &() for returning values, changed &{} to eval code and not return a value. &{} now replaces the previous usage of ${} to eval code without returning a value which might actually return a value in edge cases (e.g ${$foo = 0}).


P4 Related Software