Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
Caylan Van Larson
Howdy - Our DTM application makes extensive use of write mnemonics such as:
W /C(51,Y),$J(X,6,2),SF,/C(72,Y),$J(E,7,2) D:W ITS
Is this supported in GTM? It doesn't seem to work when I try it using Gnome terminal.
Thanks - Caylan
I know the answer is going to be yes, but I'm unsure why my terminal isn't responding to cup/c.
Caylan Van Larson
If nothing has happened since 2004 wrt write mnemonics… it looks like I'm up a creek without a paddle. Is there any way to simply define /C for cursor positioning? Help! :-)
Please look at the GTM documentation at fis-gtm.com? Look down the left side to locate user documentation then open the GTM UNIX User's manual.
Look at section 9 for terminals. You should see a table of device characteristics for screen management which includes cursor positioning.
Note this support is VERY dependent on having a matching setting of $TERM with the type of terminal your terminal emulator is actually providing.
Hope this helps..
If I understand this correctly I could rewrite my code snippet above.
U $P:(x=51:y=Y) w $J(X,6,2),SF u $P:(72,Y) w $J(E,7,2) D:W ITS
That seems clunky to me. What are the reasons for/against doing something like…
W $$c^t(51,Y),$J(X,6,2),SF,$$c^t(72,Y),$J(E,7,2) D:W ITS
… where $$c^t is some routine that outputs the escape sequence for cursor positioning.
My migration plan is to, 1) edit the DTM code to work in GTM and then, 2) use perl regex to bulk change what can't be changed. Thoughts?
GT.M evolved as a server application platform rather than a UI application platform. If you want to migrate your existing application, perhaps your strategy is best. One of GT.M's philosophies is to do well what it does well and to make it easy to leverage other packages for their strengths. So, you could consider calling out to a library such as curses.
Thanks for the replies.
Is there an easy way to add functionality to the write mnemonic handlers that doesn't involve coding in C? Is there an alternative way to add a non-intrusive routine call like /c … forgive my ignorance, but a %C or $C or something similar would make this port a heck of a lot easier.
Of course, using curses will require some level of fundamental changes in the application because if the code does terminal IO outside curses, it may confuse curses. Other applications have essentially coded their own terminal handlers in M. One example is FIS PIP (http://fis-pip.com) which is also released as free / open source software at Source Forge (http://sf.net/projects/pip). In particular, look at the _TRMVT.m routine.
It seems to me that your original idea of implementing
(see (1) below) would be pretty straight-forward. Especially since, as you point out, converting the code can easily be automated with something like:
sed -e '/\/C(/s//$$c^t(/g' <foo.m >new/foo.m
c(x,y) ; Move cursor to row y, column x.
q "" ; >>> c
If you are willing to do a little more conversion I would consider generalizing things a bit more with something like
Of course, you have to pick a maximum number of arguments:
p(x,y,s1,s2,s3,s4,s5,...) ; Move to row y, column x and Put strings s1..sn
q ; >>> p