Prop Tool as external editor ?
Rayman
Posts: 14,889
It looks to be quite a challenge to implement a code editing window just like the Prop tool. The colored background, block group indicators, etc. would be very painful to code...
Maybe one day the nice people at Parallax could provide us with a .dll code editing dialog box or some kind of OLE interface to the Prop tool itself to make it easy for us trying to edit Spin code outside of the Prop tool...
Maybe one day the nice people at Parallax could provide us with a .dll code editing dialog box or some kind of OLE interface to the Prop tool itself to make it easy for us trying to edit Spin code outside of the Prop tool...
Comments
I edit code outside of the Prop Tool all the time, I use BST:)
Or I use vim with syntax highlighting courtesy of Andrey Demenev's syntax definition file.
Then of course there are a ton of other editors for which you can customise syntax highlighting.
Mind you I guess most of those probably can't handle the block highlighting as we are used to in Spin.
Now if you really want your own syntax highlighting editor widget why not make one with the Qt library. It has a pretty decent text edit box QTextEdit that can be made to highlight text with the QSyntaxHighlighter class.
Looking at the docs I can see this should be quite straight forward and can probably be made to handle the section background colours as well.
http://doc.trolltech.com/qq/qq21-syntaxhighlighter.html
As far as I know, BST can't do this. Ok, my special interest is retro emulations, and these require #ifdef instructions and #ifdef instructions can only be coded in BST. But BST can't display Spin in a way that is easy to debug. This is mildly irritating given that programs written 30 years ago like BDS C and Sbasic are quite capable of displaying indented code in a way that is easy to follow in a modern text editor like Notebook.
So one is stuck. Code the clever stuff in BST. Code the complex logic in the Proptool. Copy and paste back and forth between the two for the really complex Spin code.
I've coded a RichTextBox parser for 30 year old Sbasic that changes all the text colors so it looks like modern vb.net. It is a challenge, but not impossible. Colored text goes a long way to making code more legible. But the little links that indicate nested functions - how do they code, and indeed, what ascii character do you use to display them?
So yes, I agree 100% - is it possible to release some sort of .dll or OLE that can assist in making Spin more legible?
If not, is it heresy (donning flame proof suit now...) to suggest the addition to Spin as a retro-non compulsory syntax change - the most wonderful programming invention contributed by C, the { and } ?
Well said.
I had a perverse thought the other day. What with the #defines in BST and the fact that C block delimiters are Spin comment block markers it would be possible to put both C and Spin code in the same file and compile it with BST or Catalina/GCC/ICC each providing a useful Prop binary. What is code for one language is comment for the other.
Obfuscation at it's finest:)
I'll preface this by saying I'm not a C programmer. But I can see beauty in programming, and in Basic and Sbasic and the evolution of Mbasic to Bascom to Qbasic to vb.net, I can see the way that structures moved towards the conventions first proposed in C.
"{" in C is "begin" in sbasic. In Mbasic it has no meaning, but in vb.net, if you write 'If' the IDE puts in 'endif' automatically and does the indenting as well, so we can see a merging of the languages. So I concede, (thinking of debates I had 20 years ago), as a very hard thing to do, that C was right all along...
Ok, what syntax could the Proptool handle for a { ?
A comment is the obvious one, but one could dream of the day that the Proptool could handle a { sitting by itself on a line and just convert it to a fixed width indent. Or even ignore it.
And conversely, a } moves the indent out by the same amount.
As Jeremy Clarkson says from TopGear, "How hard can it be?"
@Heater. @Dr_Acula
The pre-processor cpp can be used for pre-processing spin files that can be compiled by any spin tool. Output is a bit inelegant, but it works.
#include also works for re-using PASM blobs
The latest cpp is a bit picky but provides the -traditional-cpp flag:
/usr/bin/cpp -traditional-cpp -P playcpp.spin
I can save the code I want to edit to a temp file.
Thank I can invoke the Prop Tool using ShellExecuteEx
Then, I can read the code back in after the Prop Tool closes.
Easy? Really?