Writing spin editor versus integrating C
Rayman
Posts: 14,826
Facing a bit of a tough choice...
I'd like to upgrade VisualSpin to work with graphical displays.
At the same time, I'd like to include a native compiler and spin editor in Visual C++...
But, writing a Spin editor is a nightmare because of all the different colors, fonts, and indentation.
On the other hand Roy has posted a Spin compiler that should be easy to integrate.
Was just thinking today about switching to C, but here's the problem with that (please tell me if I'm wrong):
Catalina is closed source and GCC is GNU licensed and also written in GCC, so there's no way to integrate into my own closed source project.
I'd like to upgrade VisualSpin to work with graphical displays.
At the same time, I'd like to include a native compiler and spin editor in Visual C++...
But, writing a Spin editor is a nightmare because of all the different colors, fonts, and indentation.
On the other hand Roy has posted a Spin compiler that should be easy to integrate.
Was just thinking today about switching to C, but here's the problem with that (please tell me if I'm wrong):
Catalina is closed source and GCC is GNU licensed and also written in GCC, so there's no way to integrate into my own closed source project.
Comments
I'm not sure I follow ?
Those tools are usually simply called, they are not changed or renamed, or claimed as your own.
Other vendors include GCC/SDCC et al, with their Eval boards, and usually there is some part of this, that is closed source.
I think I can do that for Spin now since Roy posted his port of Chip's original source.
What I mean is... Can I include Catalina.exe or gcc.exe files into the install folder of my program and have it compile C code?
Parallax has explicit permission from Brad as well as his open-source statement on the forums.
GCC has a directory structure. Propeller-GCC is prepackaged for use. As long as the windows Path is set to the bin directory it will work. MinGW would work the same.
I'd really rather just be able to put all the required files in one folder and compile though...
You're welcome. Yes, copying the directory and then doing that extra step for setting the path in windows is kind of painful. The InnoIDE installer does it all for us.
The serious down-side of doing this though, is users cannot follow updates to the Spin compiler, or run it in batch mode.
I'm not clear on what you gain ?
What I'm trying to do is create an environment where all the dirty laundry is hidden...
I think that is because they are coded in ASM ? - the new C based Spin compiler, should allow steady fixes to be made.
You should be able to run from a tree you supply ?
We've bumped into this a couple of times, (path/set directives) with other tools
- one we avoided with an additional command line param, and the other we included a SET command in the calling wrapper.
Both tool flows can now run on a Flash Drive.
A C editor is much simpler, really just plain text...
But, how can I encapsulate a C compiler for the Prop?
Maybe Ross can make a "compiler" dll for you ? All the spin code will still be visible though.
I'm not sure if the language could be called spin or C or Basic or another language. They all look pretty similar.
What would be good though is to have buttons and textboxes that work on TV, VGA and touchscreens and the program is portable between all these types of displays. Only the resolution and color depth might be different.
So in a way this sidesteps the language wars. Realistically though, it will probably be in cached XMM C.
What I am not sure about is what language to write this in. I think rayman is looking for the source code for a compiler to drop into an existing program and I agree that would be great. Next best thing is a self contained program and you make multiple copies of the IDE and just drop them into the working folder. I've done that many times with Brads Spin Tool.
I suppose the next best thing is you write your own IDE and shell out to command line programs for compiling. I went off on a tangent over the last few days trying to work out if .net micro could be run on the propeller as that has a nice GUI front end. I don't know the answer yet but maybe it can.
Shelling Catalina, PropGCC or BST from a custom IDE is probably the quickest solution and I've done it for all three with an IDE. But my IDE is in vb.net which is about as far away from a single .exe program as you can get.
Visual spin with a single .exe IDE and compiler as part of the internal code. I'm hopelessly confused about it all!
Here's a main file example to think about. Attached is a picture of one example, though not this code.
Bonus? VisualC# IDE code is already available for programming with it (as an application).
Have you seen this ? -
https://www.sparkfun.com/products/10749
["Description: The 72Mhz FEZ Panda II runs .NET Micro Framework, allowing users to program and debug FEZ Panda using Microsoft's free Visual C# Express. Applications are loaded over USB cable (or serial) with full featured debugging capabilities, such as stepping in code or inspecting variables."]
in fact I think the prop would go superbly with a multi threading language like .net, as you can devote cogs to serial, clocks etc and have all these things running in parallel instead of a 'simulated parallel' on a PC.
Brainstorming .net maybe is for another thread, but as a start, one could build a simulator for their common language interface a bit like Zog or the Z80 emulators. Or one could write all the low end drivers in C and splice it into existing C# in .net.
With the raspberry pi and now this panda II, the world is changing. $40 computers are becoming commonplace and that is cheaper than I can build a propeller board for.
@jazzed, that looks interesting. Can xbasic be run cached, ie a megabyte program cached from an SD card?
I don't want to take over this thread too much, but it is interesting brainstorming what is out there as there could be other solutions to writing a spin editor from scratch.
The xbasic XMM runs cached. SD card XMM support is not available at the moment.
-Phil
I agree with PhiPi about command line compilers. A GUI IDE is a graphical sort of thing, but compilation is taking ascii characters and turning them into other ascii characters and that (IMHO) works better as a command line program.
Re GUI code, what we have now are some great tools for writing and building text based programs. Everything is text ultimately, even the code in C# and vb.net that describes where a button is, but it is easier to work in a more graphical environment. Drag a button onto a form.
Thinking tangentially, I went on a search for a GUI IDE where the source code is available - not just the source for the compiler, but the source for the graphical part of the IDE and the source for the syntax highlighter and all the other bits you need to develop graphical code more easily. This led me to this interesting project http://www.icsharpcode.net/OpenSource/SD/
I haven't managed to pull it to bits yet but the source code is all available and it works with multiple languages. Maybe this could lead somewhere?
-Phil
The duplication does not have to be isomorphic, however, as long as the spirit of simplicity and rapid application development are hewn to.
-Phil
Adding to the above, BST is a poor compiler to integrate into a larger tool: it doesn't have very many unique strings in it's output so it's difficult to parse. It does have a very useful (but equally un-parseable) .list feature that gives the breakdown of the code.
Hi Rayman,
Perhaps this has already been answered - but I'll answer anyway ...
Catalina - or perhaps I should say LCC - is 100% "open source", like GCC. But (also like GCC) that does NOT mean "open slather". It all depends on what you want to do with it ...
If you want to sell a "closed source" product based on a modified version of either Catalina or GCC, then I'm afraid you're out of luck. Even if you offered to pay, Parallax can't sell you a license to resell GCC as a "closed" product, and I can't sell you a license to resell LCC.
However, you can distribute your own modified version of either one - provided you distribute it as "open source". You can't charge for it directly, but you can charge to support it!
On the other hand ... if you want to sell a closed source product that can integrate with Catalina or GCC, go right ahead - that's easy. Code::Blocks provides a good model here (forget for a moment that it is also an open source product - it could just as easily be closed). You don't need to modify either Catalina or GCC to use them with Code::Blocks.
Ross.
Correct - I now include the CMM version of the Optimizer for free as part of the new Catalina 3.7, but it's still closed source. I'm loath to release the source ... because it's just soooo ugly! However, you don't really need the optimizer to produce good code - especially with CMM.
There is also the fact that Catalina currently uses HomeSpun as it's Spin compiler. It is easy enough to switch back to BST (I originally supported BST, HomeSpun and the Parallax Propeller tool, but I decided to stick to just one - and HomeSpun won out because it was far and away the most flexible. I kept hoping Parallax would fix the problems in the Propeller tool and I could switch back to that instead ... glad I didn't wait for that to happen!)
Ross.
Can't speak for GCC, but with Catalina, the answer is "yes". Catalina doesn't really need an "installer" at all - I just provided one to simplify things for Windows users. I copy versions of Catalina around all the time, and often have many different versions installed (and in use simultaneously) - each one living in a different directory.
Ross.
Let me try to be more specific about what I'd like...
My preference is usually to have a program to be a single .exe executable with no external dependencies.
For Visual Spin, I did this by including propellent as a resource and then spitting it out to a file when needed...
Anyway, what I'd like from Catalina or GCC is to be able to put all the relavant files into one folder and be able to run it.
What I'd like not to be required is that Catalina or GCC are installed by the user as a seperate step prior to be able to use my program.
BTW: Spent about an hour yesterday looking at how to do a Spin editor. It really is difficult...