Pragmatic directives: Difference between revisions
Content added Content deleted
(Add NetRexx implementation) |
|||
Line 170: | Line 170: | ||
Any possible desired effect can be achieved by calling a function or setting a variable. |
Any possible desired effect can be achieved by calling a function or setting a variable. |
||
Function calls are traced using the Trace[] function. |
Function calls are traced using the Trace[] function. |
||
=={{header|NetRexx}}== |
|||
NetRexx provides three pragma-like instructions: <tt>OPTIONS</tt>, <tt>NUMERIC</tt> and <tt>TRACE</tt>. |
|||
* '''<tt>OPTIONS</tt>''' provides the ability to pass special requests to the language processor (i.e. a compiler or interpreter). |
|||
:The syntax is:<lang NetRexx>options wordlist;</lang> |
|||
:where ''wordlist'' is one or more symbols separated by blanks. The individual words in ''wordlist'' might control optimizations, enforce standards, enable implementation-dependent features, etc. |
|||
:The current default settings of <tt>OPTIONS</tt> is:<lang NetRexx>options - |
|||
nobinary nocomments nocompact console crossref decimal nodiag noexplicit noformat java logo noreplace nosavelog nosourcedir - |
|||
nostrictargs nostrictassign nostrictcase nostrictimport nostrictprops nostrictsignal nosymbols trace2 noutf8 verbose3</lang> |
|||
* '''<tt>NUMERIC</tt>''' is used to change the way in which arithmetic operations are carried out by a program. |
|||
:The syntax is:<lang NetRexx>numeric digits [exprd]; |
|||
numeric form [scientific | engineering];</lang> |
|||
:*'''<tt>numeric digits</tt>''' controls the precision under which arithmetic operations will be evaluated. The default for ''exprd'' is '''9''' i.e. '''<tt>numeric digits 9</tt>'''.<br />There is normally no limit to the value for <tt>'''numeric digits'''</tt> (except the constraints imposed by the amount of storage and other resources available) but note that high precisions are likely to be expensive in processing time. |
|||
:*'''<tt>numeric form</tt>''' controls which form of exponential notation is to be used for the results of operations. |
|||
* '''<tt>TRACE</tt>''' is used to control the tracing of the execution of NetRexx methods, and is primarily used for debugging. |
|||
:The Syntax is:<lang NetRexx>trace tracesetting |
|||
trace var [varlist]</lang> |
|||
:where ''tracesetting'' is one of: |
|||
:*'''<tt>all</tt>''' |
|||
::All clauses (except null clauses without commentary) which are in methods and which are executed after the trace instruction will be traced. |
|||
:*'''<tt>methods</tt>''' |
|||
::All <tt>method</tt> clauses in the class will be traced when the method they introduce is invoked, together with the values of the arguments passed to each method. |
|||
:*'''<tt>off</tt>''' |
|||
::turns tracing off. |
|||
:*'''<tt>results</tt>''' |
|||
::similar to <tt>trace all</tt> for the clauses in a <tt>method</tt> with the addition that the results of all ''expression'' evaluations and any results assigned to a variable by an assignment, <tt>loop</tt>, or <tt>parse</tt> instruction are also traced. |
|||
:and ''varlist'' provides a list of variables which will be monitored during execution. |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |