Skip to content
This repository has been archived by the owner on Mar 13, 2020. It is now read-only.

Wish list: 'gosub' functionality #8

Closed
pevama opened this issue Sep 10, 2015 · 3 comments
Closed

Wish list: 'gosub' functionality #8

pevama opened this issue Sep 10, 2015 · 3 comments

Comments

@pevama
Copy link

pevama commented Sep 10, 2015

Thanks for a great start at providing a tool to allow TP programs to be written using a modern language structure.

The ability to call a 'subroutine' and return would greatly improve structure and readability. I imagine that the return could be implemented by the 'gosub' loading the return label value into a specified register. If a different register were used for each subroutine then nesting of 'gosubs' would be possible.

@pevama pevama changed the title Wish list: UFRAME_NUM=[value] ... and ... 'gosub' functionality Wish list: 'gosub' functionality Sep 10, 2015
@unreal
Copy link
Member

unreal commented Sep 10, 2015

Hi there,

Thanks for your comment.

The ability to translate UFRAME_NUM=[value] would be very useful as I frequently need to switch frames in my work.

If I recall correctly, there's the 'set_uframe()' method along with 'set_utool()'. Unfortunately the example is missing a few things. Please have a look through the tests, which should be a bit more comprehensive: https://github.com/onerobotics/tp_plus/blob/master/test/tp_plus/test_interpreter.rb

The ability to call a 'subroutine' and return would greatly improve structure and readability. I imagine that the return could be implemented by the 'gosub' loading the return label value into a specified register. If a different register were used for each subroutine then nesting of 'gosubs' would be possible.

I agree. I actually supported this sort of feature in some very early TP+ prototypes, but it did not make it into the current version. Memory management essentially was out of scope.

I've been meaning to do a large scale rewrite in Go that incorporates some of these ideas, but I haven't gotten around to it. I'm happy to accept pull requests here though ;)

Sent from my iPhone

On Sep 10, 2015, at 6:38 AM, pevama notifications@github.com wrote:

Thanks for a great start at providing a tool to allow TP programs to be written using a modern language structure.

The ability to translate UFRAME_NUM=[value] would be very useful as I frequently need to switch frames in my work.

The ability to call a 'subroutine' and return would greatly improve structure and readability. I imagine that the return could be implemented by the 'gosub' loading the return label value into a specified register. If a different register were used for each subroutine then nesting of 'gosubs' would be possible.


Reply to this email directly or view it on GitHub.

@unreal
Copy link
Member

unreal commented Jan 27, 2017

time flies.... 😨

turns out the use_utool and use_uframe methods are implemented.

still need subroutines/functions/methods though.

@pevama
Copy link
Author

pevama commented Jan 27, 2017 via email

@unreal unreal closed this as completed Mar 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants