PreSpin: a Preprocessor for Spin
Ariba
Posts: 2,690
Hi All
I will present you my PreSpin, a little Windows-application that integrates a Preprocessor and a Context Help into the Spin IDE (Propeller Tool).
I found out that one can control the IDE from a parallel running application by send-key messages. It's like you press a key on the keyboard when the IDE is selected.
So all what you can do by keyboard shortcuts, can also be done by another application.
PreSpin opens a little Window with some icons, that always stays in foreground. This icons control the Preprocessor, the Context Help and also the PropTerminal.
With a single mouseklick the actual code will be preprocessed and the result appears in a new Tab in the IDE. Then you can compile this new file and load it in the Propeller chip.
Preprocessor features:
- Conditional compilation with '#if - '#else - '#endif
- flexible Replace command
- #include command. To include other Files (also conditional)
- Macros for the Assembly section
- 2 output formats: unused lines removed, or disabled by block-comments
- Can run an external Precompiler after Preprocess and before Compile
- Can handle files generated by epmoyer's SCCuM
Context Help features:
- Shows the related page in the PropellerManual.pdf for a selected word in the IDE
- works with Acrobat- and Foxit-Reader
- The Index-file, can be extended by you.
If you use PropTerminal, PreSpin can automatically minimize it before a code-upload, and restore it afterwards. It is like PropTerminal where integrated in the IDE.
Many, many thanks to kaio, for his testing, his suggestions, and the registry and template files. PreSpin would not be on this level without him.
Some words about the attached ZIP: You can unzip it into the Propeller-Tools directory, and you have all files at the right place. If you first want to make a minimal test, copy the PreSpin.exe and the PropManualIndex.txt to the PropellerTools directory (where Propeller.exe resides), and the PreprocTest.pre in a spin working directory. Then start PreSpin.exe, this starts also the Propeller Tool, if necessary.
PreSpin is a very little application (ca. 60 kByte) that needs no additional Runtime !
Have fun
Andy
I will present you my PreSpin, a little Windows-application that integrates a Preprocessor and a Context Help into the Spin IDE (Propeller Tool).
I found out that one can control the IDE from a parallel running application by send-key messages. It's like you press a key on the keyboard when the IDE is selected.
So all what you can do by keyboard shortcuts, can also be done by another application.
PreSpin opens a little Window with some icons, that always stays in foreground. This icons control the Preprocessor, the Context Help and also the PropTerminal.
With a single mouseklick the actual code will be preprocessed and the result appears in a new Tab in the IDE. Then you can compile this new file and load it in the Propeller chip.
Preprocessor features:
- Conditional compilation with '#if - '#else - '#endif
- flexible Replace command
- #include command. To include other Files (also conditional)
- Macros for the Assembly section
- 2 output formats: unused lines removed, or disabled by block-comments
- Can run an external Precompiler after Preprocess and before Compile
- Can handle files generated by epmoyer's SCCuM
Context Help features:
- Shows the related page in the PropellerManual.pdf for a selected word in the IDE
- works with Acrobat- and Foxit-Reader
- The Index-file, can be extended by you.
If you use PropTerminal, PreSpin can automatically minimize it before a code-upload, and restore it afterwards. It is like PropTerminal where integrated in the IDE.
Many, many thanks to kaio, for his testing, his suggestions, and the registry and template files. PreSpin would not be on this level without him.
Some words about the attached ZIP: You can unzip it into the Propeller-Tools directory, and you have all files at the right place. If you first want to make a minimal test, copy the PreSpin.exe and the PropManualIndex.txt to the PropellerTools directory (where Propeller.exe resides), and the PreprocTest.pre in a spin working directory. Then start PreSpin.exe, this starts also the Propeller Tool, if necessary.
PreSpin is a very little application (ca. 60 kByte) that needs no additional Runtime !
Have fun
Andy
zip
122K
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
I have found a problem with the registration file which provides not the right values for users using an english version of Windows. Maybe also other languages could be involved.
If your programs are stored in "C:\Program Files" then please use the attached registration file. Copy the file in your preferred directory and perform the registration by double click.
The file delivered in the PreSpin archive works fine for german speaking countries.
Thomas
I use the syntax suggested by epmoyer, but I have it fairly extended. So it's no problem to preprocess a file, that is intended for SCCuM also with PreSpin. And also files that are already preprocessed by SCCuM, can still be used with PreSpin.
In the other direction, it's also compatible if you only use #DEFINE, #IF and #ENDIF (in capitals).
The big difference is, that PreSpin generates an intermediate file (preprocessed.spin) that will be compiled. After compile, this file is no longer needed. Nothing has to be changed in the original source file. Includes and macros are possible with this approach, and it's the same as a C preprocessor works.
More, with the ability to run another command-line program between the preprocess and the compiler, it should be possible to make things like a C to Spin converter, or a Basic to Large-Assembly-model compiler. And this all in the existing IDE, with a single mouseclick.
Andy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Definetly a E3 (Electronics Engineer Extrodinare!)
"I laugh in the face of imposible,... not because i know it all, ... but because I don't know well enough!"
Have you thought about adding a condition code facility to the macros? You could use \0 as the parameter for any condition code that's used with the macro invocation. That way \0 could be used only in those lines of the macro definition where it's appropriate. If you really wanted to get fancy, the term !\0 could be used to insert the opposite condition from \0, allowing an if...then...else construct within the macro.
-Phil
you can do this also with the existing version, you simply add the condition as a parameter:
with two parameter-conditions, you can alse realize a if/else.
But I agree, that this is not so well readable, as if the condition stays before the macro instruction.
Perhaps I add this, when I touch the PreSpin code next time.
Andy
A question: I got the impression that context help would open to the proper page when an index entry is double-clicked.· That does not happen for me.· Acrobat opens, but always at page 1.· (I am using Adobe Reader 8.1.1) Is there an explanation?
I recommend to use the FoxitReader, it's a free PFD Reader that is not so big as the Acrobat and therefore much faster.
The context help was tested with Acrobat 6 and worked with that version.
Because PreSpin gets no feedback from the started PDF-Reader, I analyse the Titel Bar of all Open Windows, and perhaps the Text in TitelBar has changed significantly to previous versions in Acrobat 8 ?
Can you give me the exact Text in the Titel Bar of an open AcrobatReader 8.1.1 with an open Propeller Manual.
Does it also not work when the Reader is still open?
And BTW you know ?: the normal use of the context help is to select a word in the source and click then on the icon, the index list opens then only if the word is not found.
Andy
Post Edited (Ariba) : 1/16/2008 12:40:59 AM GMT
I attached a snapshot that may be helpful.
I do know that the normal use of context help is to highlight a term and then click the context help icon.· In my case, that always brought up page 1 of the manual.
I'm not familiar with the FoxitReader, but I'll give it a try.
Thanks.
I loaded up Foxit Reader. Everything works as expected. And it is much faster than Adobe.
Thanks again.
Bob
Another change for the next version...
But I'm glad that it works for you now [noparse]:)[/noparse]
Andy
I would pay for a version that would allow me to compile and run (to a virtual prop) with break points. It is so much more difficult without being able to step through the code in real time.
It's a long time since I've done this, but I use it every time when I start the PropTool (mainly to auto-control the PropTerminal).
@Roadster
If you use PropTerminal, then PreSpin gives you an Icon to Compile and Run a Spin file, but also minimizes first PropTerminal and restores it right after the download has finished.
@turbosupra
Nothing to higlight and comment out, but in Spin you have the { } curly brackets for that.
ViewPort has a Debugger with Breakpoints and Single-Step for Spin, and you even can pay for it ;-)
Andy
andy: I presume this does not work with bst, which is what I use for complex programs now. For simple ones, I stick to PropTool only because I can publish the code and anyone can use it.
The INCLUDE feature is one that I really require when doing code modules for the OS I am working on. Most of the code is identical, so it makes it easy for anyone to write OS extensions, like a better DIR command, etc. Shortly I will give your prespin a try at this as I think this will be one of the solutions I have been looking for.
Thanks again Andy. It is amazing of how much has been done in the past and is burried in these forums.
I think it probably isnt finding the file to include because it does copy the file to the new tab in proptool.
I am using PropTool 1.30 located in C:\PropTool130 and my spin file and include file are both in C:\Propeller\RamBladeOS\PropOS_002
I am running Windows XP SP3 English
I have attached the two programs in question in case you can see something silly.
Postedit: Solved. Andy's program requires a preceeding apostrophe making the include directive a comment.
_FREE2.spin_inc.spin
Yes, all the preprocessor directives are written as special comments.
If PreSpin has not the right path for the incude file, or the objects, then it helps to load the Spin file over the Load icon of PreSpin.
Andy
Works great! Some nice gems like this are so easily overlooked.