Shop Learn
Spin2 editor (now works with P1 & P2) - Page 4 — Parallax Forums

Spin2 editor (now works with P1 & P2)



  • I usually modify mine from default a bit, mainly in the PASM stuff. The default has too many things the same color (red).
  • RaymanRayman Posts: 11,818
    PASM keywords jumped from 122 for P1 to 396 for P2.
    Will be interesting to see if this slows down this editor...
  • RaymanRayman Posts: 11,818
    Think I have Spin2 mode kind of working :)
    1148 x 1176 - 127K
  • AleAle Posts: 2,360
    Rayman, one question... are you going to publish your code somewhere ?
    It is not that I want to look at it, it is that with the loss of BST's source code a (imho) great loss happened, shouldn't happen again.
  • RaymanRayman Posts: 11,818
    Usually, I'd say no. But, I'm leaning towards making an exception in this case. Mostly because it's mostly somebody else's code. I just played around with the colorizer a bit...
  • RaymanRayman Posts: 11,818
    Put new .exe zip file in first post.

    It is now in P2 mode with open and save file enabled.
    Added some code to speed up screen updates. Was getting bogged down when file size got big before.

    Added font sizing using ctrl-wheel, like Prop Tool.
  • Heater.Heater. Posts: 21,233
    Publishing this source code might be tricky. I uses an edit control by Chris Losinger and there is no license attached to it specifying how it may be used or distributed.

    Mind you, the same can be said of any binary executable that includes that code.

  • RaymanRayman Posts: 11,818
    License looks like this:
       Copyright (C) 2001 Smaller Animals Software, Inc.
       This software is provided 'as-is', without any express or implied
       warranty.  In no event will the authors be held liable for any damages
       arising from the use of this software.
       Permission is granted to anyone to use this software for any purpose,
       including commercial applications, and to alter it and redistribute it
       freely, subject to the following restrictions:
       1. The origin of this software must not be misrepresented; you must not
         claim that you wrote the original software. If you use this software
         in a product, an acknowledgment in the product documentation would be
         appreciated but is not required.
       2. Altered source versions must be plainly marked as such, and must not be
         misrepresented as being the original software.
       3. This notice may not be removed or altered from any source distribution.
  • Heater.Heater. Posts: 21,233
    Ah, OK, cool. Good to go.

  • RaymanRayman Posts: 11,818
    Main thing that bothers me right now is that you can have multiple background colors on a single line in the Prop tool, but not with my code.

    This could be fixed by creating a list of multi-colored lines and then drawing them specially.
    But, I don't feel like doing it because I think it's bad style...

    Can we define Spin2 to only recognize the first section keyword on a line?
    409 x 77 - 4K
  • Roy ElthamRoy Eltham Posts: 2,992
    edited 2018-09-07 01:28
    The Spin compiler will only recognize the section keywords as the first thing on a line. It will give you an error for any section keyword parsed that doesn't start on column 1.
    So, while you can type that mess into PropTool and see it colored that way, it shouldn't compile.

    It's fine if your editor does not color them the same as PropTool, since it's invalid. In fact, it's probably better to have it not coloring it like PropTool does, since it visually signals that something is wrong.
  • Is there a way to capture the response of the compiler and parse for error on line number xxx then highlight the line number or scroll to the line number and indicate the line number. Or at least show the line number in a text box.
  • RaymanRayman Posts: 11,818
    Roy Eltham wrote: »
    The Spin compiler will only recognize the section keywords as the first thing on a line...

    Thanks Roy! That helps a lot.
    I was about to say it's done, but just noticed that VAR and OBJ have different keywords than PUB and PRI.
    I think CON might be different as well...

    Guess I'll just paste all the keywords in the Prop Tool and see what highlights...
  • RaymanRayman Posts: 11,818
    T Chap wrote: »
    Is there a way to capture the response of the compiler and parse for error on line number xxx then highlight the line number or scroll to the line number and indicate the line number. Or at least show the line number in a text box.

    That should be straightforward, we'll see...
  • RaymanRayman Posts: 11,818
    edited 2018-09-07 14:02
    Looks like CON and VAR have the same subset of keywords. OBJ only seems to have 3 keywords (float round trunc)...

    Also, there's a nasty bug in Prop Tool where parenthesis characters in VAR section mess up the background color...

    677 x 709 - 28K
  • Good news! The app seems to work great in Wine :) Not sure if I'm using the latest one or not (it's the one in your first post), but it seems to be highlighting things nicely and not crashing, which is generally a win for any app in Wine :P
  • RaymanRayman Posts: 11,818
    Thanks for trying that! I thought it might work with Wine...
    I've heard that basic MFC apps work pretty well under Wine...

    I'm going to try to force myself to post the code today (before I get too attached to it)...
  • Another nice thing about BST was folding. That might be tricky but it is really nice to fold up the code so you only see the method names until you click on the method name then the methods code expands.
  • This is really exciting, @Rayman! I was able to get it to run under Wine as well, although since I don't have the Propeller font the text didn't come out very well (letters were overlapping sometimes). Probably not something to worry about for a long time, if ever.

    I didn't see a menu option to compile or run. Did I miss it, or is that still on the TODO list?

  • RaymanRayman Posts: 11,818
    My main objective was to make a P2 version of Spin tool...
    But, I also made it a P1 editor along the way.

    As of now, it's just a very basic text editor.
    But, I've seen code I can borrow to make it compile and run Spin2.
  • RaymanRayman Posts: 11,818
    Ok, I posted the source to the top of the thread.
  • Heater.Heater. Posts: 21,233
    I'm going to try to force myself to post the code today (before I get too attached to it)...
    Do not post your code here. Then you are into a spiral of posting update after up date.

    Better to put it into a git repository and push it to github or bitbucket

    Then you have a thing. A project. Everyone will know were to find it. It will be easy for people to find the latest version. Quite likely people will turn up to contribute code for new features or bug fixes. At least they will have a place to report bugs, in github's issue tracker for example.

    Generally I have a downer on people producing platform specific code. In this case Windows. It's not so hard now a days to create code that can be built for Windows, Mac and Linux. And others.

    However, as a long time Linux user I also harbor an evil thought... Perhaps sometimes the simplest, easiest way to create a program that anyone can use is to stick to the old Windows API's. Then you have a single build of your program that will run on Windows and all the thousands of different Linux systems thanks to Wine. No doubt the Mac guys have a way to run it as well. No need to make specific builds for different operating systems, no need to rely on Linux distro package maintainers to support it.

    A prime example of this is one of my favorite programs of all time, the LTSpice circuit simulator by Linear Technology. That is a big and complex application that has always worked flawlessly under Wine. I suspect Linear goes out of their way to ensure that is always so.

  • Heater.Heater. Posts: 21,233
    Well, blow me down. Just an hour or so after my expounding on my "evil" thoughts about writing to the Win32 API as a good way to make cross-platform software, I find this from a couple of days ago by Bryan Lunduke:

  • RaymanRayman Posts: 11,818
    edited 2018-09-07 23:04
    Although written for Windows, I think you'll see most of the original code was just standard C++, outside of the GUI drawing. I would think the GUI part could be fairly easily reproduced in Qt.

    So, even if this code isn't inherently cross-platform the colors, data, and logic is there for someone who wants to make it cross platform...

    Of course, my stuff has a lot of MFC, like CString, for example. But, it's not too hard to fix that or use Qt equivalent...
  • RaymanRayman Posts: 11,818
    edited 2018-09-07 20:17
    On the other hand, assuming it really does work under Wine and you're willing to use shell commands to program over serial port, might be OK as is...

    I'd bet serial port code in WIN32 would not work under Wine (but maybe I'm wrong).
  • RaymanRayman Posts: 11,818
    edited 2018-09-07 23:49
    Wow, this must be relatively new... Looks like you can do some symbolic link magic in Linux and make Win serial port code work under WINE:

    But, that may not give you access to do DTR line. Or?
  • cgraceycgracey Posts: 13,375
    Looking great, Ray!

    I'm getting the interpreter tuned up. It's 95% done. I still have compiler work ahead. It's all going to work really nicely. Compact, fast, and potent.
  • Heater.Heater. Posts: 21,233

    Getting the serial ports working on Linux should not be a problem.

    Thing is WINE is not an emulator. It's not just for running compiled Windows executables. There is libwine the library that implements the Win32 and other Windows API's and there is wine that loads and runs Windows binaries.

    One can actually compile Windows programs using GCC on Linux, linking them with libwine and then run them like any other Linux program. Without actually going near any actual Windows machine. Years ago I did exactly that as an experiment. My simple Win 32 program with buttons, dialog boxes and such compiled and ran without fuss. It was kind of spooky.

    So, given that you release the source code some kind soul might take up the challenge of adding Linux serial port support.

    From the libwine documentation:

    What you gain by recompiling your application with Winelib is the ability to make calls to Unix APIs, directly from your Windows source code. This allows for a better integration with the Unix environment than is allowed by running an unmodified Windows application running in Wine. Another benefit is that a Winelib application can relatively easily be recompiled on a non-Intel architecture and run there without the need for a slow software emulation of the processor.'s_Guide#What_is_Winelib.3F

  • RaymanRayman Posts: 11,818
    I've turned the "Class View" window into a "Section View". The tree now lists all the sections.

    If you double-click on a section in the tree, the main view jumps to that line.

    I'm thinking about changing the icons in the tree so they have matching colors to their respective section...

    I think this can replace the "Summary" view of the Prop Tool... Might be even better as you can keep it open all the time...
  • RaymanRayman Posts: 11,818
    Forgot screenshot:
    1030 x 1049 - 90K
Sign In or Register to comment.