On Sun, Jun 21, 2009 at 11:42:52AM +0800, Dasn scribed:
> 
> I have no idea of HP-41 FOCAL format, I think here is a big deal:
>       while search("^\d\d\d ", "W") > 0
>           execute "normal 3cl\<c-y>\<c-y>\<c-y>\<esc>\<c-a>"
>       endwhile
> First, I don't think "^\d\d\d" will work for normal cases, do you mean
> '^\d\d\d' (single quote)?
> Then, for the performance, a simple substitute would be more effective
> than the 'while' loop, e.g.: 
> 
> function! Renumber()
>     let s:linenumber = line(".")
>     let s:colnumber = col(".")
>     call cursor(1,1)
> 
>     " mess up a register
>     let @r = 1
>     exe "normal 0cw".printf("%03d", @r)
>     2,$s#^\d\d\d #\=printf("%03d ", @r + setreg('r', @r+1))#
> 
>     call cursor(s:linenumber,s:colnumber)
> endfunction

Great stuff. This makes all the difference. I'm updating my script :-)

FOCAL = FOrty-one CALculator language.
It's the user space programming language of the HP-41.
More here: http://www.isene.com/artweb.cgi?hp-41

Thanks.

->Geir Isene :)

-- 
Daglig leder / CEO FreeCode AS
Cell:  +47 - 473 44 000
Phone: +47 - 21 53 69 00, Fax: +47 - 21 53 69 09
Addr:  Nydalsveien 30b, 0484 Oslo
Web:   http://www.freecode.no/

Want faster communications? Send me your message as a WOIM-list:
http://www.isene.com/artweb.cgi?article=012-woim.txt

Attachment: signature.asc
Description: Digital signature

Reply via email to