Name:
Preprocessor Substitutions
Syntax:
ppp_filename   main file filename
use within main or include files
ppp_filepath   main file filename (with path)
use within main or include files
ppp_includefilename   include file filename
use within include files only
ppp_includefilepath   include file filename (with path)
use within include files only
ppp_date   "YYYY-MM-DD"
ppp_date_uk   "DD-MM-YYYY"
ppp_date_us   "MM-DD-YYYY"
ppp_time   "HH:MM:SS"
ppp_datetime   "YYYY-MM-DD HH:MM:SS"
Description:

Pre-processor string substitutes. When the pre-processor parses the file it replaces these special ppp_ names with the current filename/date/time as appropriate. Date and time are taken from the computer's system clock.

 

ppp_filename

This substitutes the name and extension of the main file enclosed in quotation characters. For example a New Document1.bas file will be substututed as "New Document1.bas" including the quotation characters.

ppp_filepath

This substitutes the full path, name and extension of the main file enclosed in quotation characters. For example a test.bas file located in the c:\picaxe folder will be substututed as "c:/picaxe/test.bas" including the quotation characters. Note that the directory separator / is used.

ppp_includefilename

This substitutes the name and extension of the current included file enclosed in quotation characters.

ppp_includefilepath

This substitutes the full path, name and extension of the current included file enclosed in quotation characters. 

ppp_date

This substitutes an ISO format date in the form "YYYY-MM-DD" including the quotation characters.

ppp_date_uk

This substitutes a UK format date in the form "DD-MM-YYYY" including the quotation characters.

ppp_date_us

This substitutes a US format date in the form "MM-DD-YYYY" including the quotation characters.

ppp_time

This substitutes the 24 hour time in the form "HH:MM:SS" including the quotation characters.

ppp_datetime

This substitutes an ISO format date and time in the form "YYYY-MM-DD HH:MM:SS" including the quotation characters.

Applies To:
All
See Also:
Related Create:
    Share:
    Print:

    Preprocessor expansions

    The following shows how preprocessor substitutions will be expanded. The file the substitutions are included in is "c:/user/picaxe/test.bas" and with syntax checking performed at 15:30:00 on the 31st of January, 2013.

    Code Example:
    ; Source code as typed -
    
    sertxd( ppp_filename )
    sertxd( ppp_filepath )
    sertxd( ppp_date )
    sertxd( ppp_date_uk )
    sertxd( ppp_date_us )
    sertxd( ppp_time )
    sertxd( ppp_datetime )
    
    ; Source code as the compiler sees it after pre-processing -
    
    sertxd( "test.bas" )
    sertxd( "c:/user/picaxe/test.bas" )
    sertxd( "2013-01-31" )
    sertxd( "31-01-2013" )
    sertxd( "01-31-2013" )
    sertxd( "15:30:00" )
    sertxd( "2013-01-31 15:30:00" )
    Copy Code Submit an Example

    Submit Your Own Code!

    You must be logged in to submit code examples. Login now.

    Comments

    • Login to leave a comment.