PL/I preprocessor: Difference between revisions

Content deleted Content added
BG19bot (talk | contribs)
m WP:CHECKWIKI error fix for #61. Punctuation goes before References. Do general fixes if a problem exists. - using AWB
Line 1:
{{nomore footnotes|date=February 2012}}
The '''PL/I preprocessor''' is the [[preprocessor]] for the [[PL/I]] computer [[programming language]]. The preprocessor interprets a subset of the full PL/I language to perform [[source file]] inclusion, [[conditional compilation]], and [[Macro (computer science)|macro expansion]].
 
Line 23:
==Preprocessor operation==
 
The preprocessor operates by scanning the input text and recognizing declared ''preprocessor names'', also called ''preprocessor identifiers''. The text is copied to the preprocessor output with the preprocessor names replaced with their current values. The name may represent a call to a ''preprocessor procedure'' ([[Macro_Macro (computer_sciencecomputer science)|macro)]]. Replacement text may be rescanned by the preprocessor for possible additional replacement.
 
===Preprocessor data types===
 
Preprocessor data may be declared to be CHARACTER, a character string with no maximum length, or FIXED an integer number of up to five decimal digits. A ''preprocessor builtin'' is a predefined procedure operating on preprocessor data. A ''preprocessor expression'' is an expression consisting only of preprocessor names, references to preprocessor procedures or builtins, and decimal or character constants. There are no BIT variables, but a BIT result may be obtained by comparison. The expression in %IF evaluates to BIT. All PL/I operators are allowed except exponentiation.
 
===Preprocessor statements===
 
Line 37:
*'''%DO''' heads a preprocessor DO-group, which is used to group statements and possibly specify iteration. A preprocessor DO-group can contain any combination of preprocessor statements and input text.
*'''%PROCEDURE''' heads a preprocessor procedure, a set of preprocessor statements that functions as a macro returning a value when its name is encountered in the input text.
*'''%SELECT''' heads a preprocessor [[Switch_statementSwitch statement|SELECT-group]].
*'''%END''' terminates a preprocesor DO-group, SELECT-group, or preprocessor procedure.
*'''%GOTO''' (or %GO TO) causes the preprocessor to continue its scan at the specified preprocessor label, either a preprocessor statement or an arbitrary point in the input text.
Line 68:
 
==Example==
The following example for IBM PL/I for OS/2 illustrates the use of a preprocessor procedure to implement a C-like write statement for PL/I.<ref>{{cite web|last=Sturm|first=Eberhard|title=UIO-Makros für Builtin-Funktionen fileread und filewrite|url=http://www.uni-muenster.de/ZIV.EberhardSturm/uio.cpy|accessdate=January 22, 2012}}</ref> . The procedure would be called by coding the statement <code>uwrite file(''filename'') from(''varying_string'') count(''byte_count'');</code> ''Byte_count'' is optional and defaults to the length of ''varying_string'' if omitted.
<source lang=PLI>
%uwrite:
Line 137:
|title = Micro Focus Documentation: Open PL/I Macro Preprocessor
|author = Micro Focus International plc
|dateyear = 2011
|accessdate = Feb 14, 2012
}}
Line 145:
|title = Kednos PL/I for OpenVMS Systems Reference Manual: Chapter 10 Preprocessor
|author = Kednos Enterprises
|dateyear = 2007
|accessdate = Feb 14, 2012
}}
 
{{DEFAULTSORT:PL I preprocessor}}
 
[[Category:PL/I programming language family]]
[[Category:IBM software]]