home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d9xx
/
d987
/
mcalc.lha
/
MCalc
/
ARexx
/
CalcTeX.ced
< prev
Wrap
Text File
|
1994-04-05
|
2KB
|
83 lines
/************************************************************************
*
* CalcTeX.ced by Kai Iske
*
* Takes the expression enclosed by quotes and replaces
* it with the result (TeX output)
*
*
* LoopUp part taken from (and modified a bit) :
*
* LookUp.ced Copyright (c) 1989, Peter Cherna
*
* ARexx program for CygnusEd Professional that looks up the word under
* the cursor.
*
* Version 1.30: August 20, 1989 Release 1.2: August 29, 1989
*
************************************************************************/
OPTIONS RESULTS
ADDRESS 'rexx_ced'
tabchar = '09'X
cr = '0A'X
/* Get contents of current line: */
status 55
line = result
/* Get tab size: */
status 8
tabadjust = result - 1
/* Get cursor x position (relative to beginning of line = 1): */
status 46
cur = result + 1
status 47
currentline = result + 1
i = index(line,tabchar)
DO while i > 0 & i <= cur - tabadjust
cur = cur - tabadjust
i = index(line,tabchar,i+1)
END
/* Find leftmost and rightmost alphabetic character adjacent to current: */
left = cur + 1
char = ' '
DO while (char ~= '"') & (left > 0)
left = left - 1
if left > 0 then
char = substr(line,left,1)
END
right = left + 1
char = ' '
DO while (char ~= '"') & (right <= length(line))
right = right + 1
char = substr(line,right,1)
END
if right-left < 1 then
exit
else
target = substr(line,left+1,right-left-1)
JUMPTO currentline left
MARK BLOCK
JUMPTO currentline right + 1
CUT BLOCK
ADDRESS 'MCALC' "CALCTEX" target
TEXT result
exit