1/*
2$Id: l.the,v 1.3 2008/09/26 07:21:15 mark Exp $
3*/
4/***********************************************************************/
5/* Description: REXX prefix macro to LOWERCASE a line or block of lines*/
6/* Syntax:      nL or Ln or -nL or L-n or L/target                     */
7/* Notes:       This macro can also be invoked as a block prefix       */
8/*              command by entering LL in the prefix area.             */
9/*              For the LL block prefix command to work, you must      */
10/*              define LL as a valid prefix synonym with:              */
11/*                                                                     */
12/*                SET PREFIX SYNONYM LL L                              */
13/*                                                                     */
14/*              This prefix macro can be used as a template for other  */
15/*              prefix macro commands by changing the command to be    */
16/*              executed specified on the second line of this macro.   */
17/*                                                                     */
18/*              This prefix macro is slightly different from the       */
19/*              equivalent L Prefix Macro defined in the XEDIT User's  */
20/*              Guide:                                                 */
21/*                                                                     */
22/*              1) The arguments passed to prefix macros contain the   */
23/*                 name the macro was invoked with. This is because    */
24/*                 the REXX interpreters that THE uses cannot provide  */
25/*                 this information from the PARSE SOURCE command.     */
26/*                                                                     */
27/*              2) The check for a whole number as an argument to the  */
28/*                 prefix macro has been removed so that THE's extended*/
29/*                 prefix macro targets can be specifed.               */
30/***********************************************************************/
31Trace o
32the_command = 'LOWERCASE'
33Parse Arg pref name func pline op extra
34If pref \= 'PREFIX' Then Call error1 'This macro must be called from PREFIX area'
35If func = 'CLEAR' Then exit
36If func = 'SHADOW' Then Call error1 'Invalid on SHADOW line'
37If func \= 'SET' Then Call error1 'This macro must be called from PREFIX area'
38If extra \= '' Then Call error1 'Extraneous parameter:' extra
39Select
40  When Length(name) = 1 Then
41       Do
42         If op = '' Then op = 1
43         'COMMAND :'||pline the_command op
44       End
45  When Length(name) = 2 Then
46       Do
47         If op \= '' Then Call error "Invalid operand:" op
48         'COMMAND EXTRACT /PENDING BLOCK' name ':0 :'pline '/'
49         If pending.0 \= 0 Then
50            Do
51              'COMMAND :'pending.1 'SET PENDING OFF'
52              'COMMAND :'pending.1 the_command ':'pline+1
53            End
54         Else 'COMMAND :'pline 'COMMAND SET PENDING BLOCK' name
55       End
56  Otherwise Call error "Invalid macro synonym."
57End
58'COMMAND CURSOR FILE' pline 'PRIORITY 30'
59Exit
60
61error:
62'COMMAND :'pline 'SET PENDING ERROR' name||op
63
64error1:
65Parse Arg t
66'COMMAND EMSG' t
67Exit
68