home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format 106
/
af106sub.adf
/
ARCLIC.lzx
/
ArCLIC
/
ARCLIC.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
2003-05-16
|
7KB
|
144 lines
/* ARexx script ARCLIC.rexx **********************************1*\
**INTRODUCTION *
* This script provide an ARexx Command-Line Interpreter Console *
* in a normal shell console. You can run it in every type of *
* console like NewCon:, KingCon: or any else. *
* *
**INSTALLATION *
* Simply copy the script to your REXX: drawer. *
* *
**SYNTAX *
* In normal way you will run it from shell with the following *
* syntaxe: *
* RX ARCLIC [PORT] *
* *
* If the argument PORT is provided, the interpreter will begin *
* at this ADDRESS. *
* If else, the port 'COMMAND' will be used. *
* *
* Note 1: The server ARexx: 'RexxMast' must be present! *
* Also make a double-click on the RexxMast's icon in the *
* "System" drawer of your workbench's disk. *
* or add the following line to your 'S:User-Startup' *
||SYS:System/RexxMast >NIL: ||
* *
* Note 2: you must have the path to 'SYS:Rexxc/' present in your *
* path-list. Or else you must add the path to the command: *
* SYS:Rexxc/RX ARCLIC [PORT]. *
* *
* Or you can simply make a double-click on his icon (see note 1) *
* *
**FEATURES *
* * Error trapping (not developped but trapped) *
* * No use of variable (you can use every you want) *
* * Prompt with the Return Code and the Result of the last *
* command, and the address where you work. *
* Note that if you want to modify the prompt, there is no *
* variable! You must modify the script but it's simple! *
* * It's an example of AddOn to the promt: the time info. *
* Go take a look! *
* * Way to add special user function (Its two examples *
* functions: ARCLIC_Mille() and ARCLIC_Info() ) *
* *
**DISCLAIMER *
* This script is provided as is. I am not responsible in any way *
* if somethig wrong, go down or else. I can not be responsible *
* of any dammage caused to your computer, your datas, your wife *
* or any else. *
* *
* Be care when you use some rexxs librarys! With the ARexx you *
* can direct access to sensible memory or dangerous library *
* calls!!! *
* *
**COPYRIGHT *
* This script may be freely distributed without profit! In *
* in unmodified version!!! *
* *
**AUTHOR: *
* Félix Hauri - Informaticien consultant |\ /| *
* -------------------------------------- | \__/ | *
* 7, rue Centrale / CH-1450 Sainte-Croix | . . | *
* tél: (+41/0)24 454 54 04 /fax:...54 00 | /\ | *
* http://www.gkb.com/ch/hauri/home.html | \__/ | *
* mailto:hauri_felix@bluewin.ch \____/ *
\****************************************************************/
/*\* ARexx script ARCLIC.rexx **********************************2*/
Say '1b5b481b5b4a'x || 'Welcome to ARCLIC.rexx!' '0a'x || 'Prepare',
'and test your scripts... Good work!' '0a'x || 'Type ''Exit''',
'to leave the interpreter!'
Interpret 'ADDRESS' ARG(1)
ERROR:
IF (RC>0)&(RC~='RC') THEN DO
Say ERROR RC':' ErrorText(RC)
RC=
END
SYNTAX:
IF (RC>0)&(RC~='RC') THEN DO
Say SYNTAX RC':' ErrorText(RC)
RC=
END
HALT:
IF (RC>0)&(RC~='RC') THEN DO
Say 'HALT : Interrupt call!'
RC=
END
FAILURE:
IF (RC>0)&(RC~='RC') THEN DO
Say 'FAILURE :' RC
RC=
END
SIGNAL ON ERROR
SIGNAL ON HALT
SIGNAL ON FAILURE
SIGNAL ON SYNTAX
OPTIONS FAILAT 100
OPTIONS RESULTS
DO FOREVER
/* There is the prompt! you can try to keep the comment braket of
for adding the time to the prompt (dont miss the comma!) */
CALL WRITECH( STDOUT , '1b5b33326d'x || RC || '|' ||,
TIME() || '|' ||,
RESULT || '|' || ADDRESS() || '3a1b5b33316d'x )
INTERPRET READLN(STDIN) /* The only line to realy do forever... */
END
exit 0
/*\* ARexx script ARCLIC.rexx **********************************3*/
/************************************************************\
* *
* From there, comme the user's function's library *
* *
\************************************************************/
ARCLIC_Mille: PROCEDURE
Nombre=ARG(1)
IF DATATYPE(Nombre,'NUM') THEN DO
l=TRUNC((LENGTH(Nombre)-1)/3)
IF l > 0 THEN DO i=1 to l
Nombre=INSERT('''',Nombre,LENGTH(Nombre)-3-3*(l-i))
END
END
Else Nombre='Error!' Nombre 'are not a number'
RETURN Nombre
EXIT 0
ARCLIC_Info: PROCEDURE
Say 'Task ID :' PRAGMA(I)
OStack=Pragma('S',0);Call Pragma('S',OStack)
Say 'Current stack :' ARCLIC_Mille(OStack)
Say 'Current dir :' PRAGMA(D)
Say 'Current time :' Time()
Say 'Current date :' Date()
Say 'You work at :' Address()
Call Writech(STDOUT,'Memory free : ')
ADDRESS COMMAND 'AVAIL TOTAL >T:tmp' || PRAGMA('ID')
Call OPEN(IN,'T:tmp' || PRAGMA('ID'))
TotMem=READLN(IN)
Call CLOSE(IN)
ADDRESS COMMAND 'Delete >NIL: T:tmp' || PRAGMA('ID')
Say ARCLIC_Mille(TotMem)
RETURN ''
EXIT 0