phrep

Update of "phrep"
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: 761bb8fe7d0ca4c12480b805f29febe050cbe507
Page Name:phrep
Date: 2015-04-28 22:18:02
Original User: mario
Mimetype:text/x-markdown
Parent: 8b84dda9a4dabdb56346a746cbc78a9a2b7950e9 (diff)
Next 22491662b8cc2d5689c0c68b0bb4c0cbd8e2f36a
Content

PHP Macro Preprocessor

phrep is a command-line macro preprocessor for PHP code.

It's intended as static configuration tool...

Usage

Preprocessing a source script is as simple as:

 phrep -i config.src -o config.php -D PKG_USE_SQLITE=1

Where source files might look like this:

 <?php
 #if __PHP_VERSION__ >= 5.4 && defined(PKG_USE_SQLITE)
  #pragma(dirs=./includes)
  #include <sqlite.ph>
 #else
     include("./lib/basic_db.php");
  #ifdef PKG_DB_EXTENSION
     $db->option = PKG_DB_EXTENSION;
  #endif
 #endif

Most preprocessor constants are just meant for conditional sectioning. But they can also be substituted in PHP code blocks. Just like macros such as HTML($var) or even PARAMETERIZE@(select $x FROM $y).

Status

Download