Shop OBEX P1 Docs P2 Docs Learn Events
.Spin file format? — Parallax Forums

.Spin file format?

RinksCustomsRinksCustoms Posts: 531
edited 2012-06-18 18:17 in Propeller 1
Anyone know about the formatting in a spin file used by the ide? I'm interested in starting an android spin file viewer/ editor.

Comments

  • msrobotsmsrobots Posts: 3,709
    edited 2012-06-17 13:16
    RinksCustoms,

    Spin-Files are normally ASCII-Text Files.
    every line ends with CR LF.

    Under windows sometimes they get saved with windows-encoding instead of ASCII.

    Linux has problems with that. But files saved under linux (as usually for linux) are missing CRs on the end of the line be aware of that.

    Enjoy!

    Mike.

    yes. It is allways good to be in CA ...
  • Heater.Heater. Posts: 21,230
    edited 2012-06-17 13:27
    For sure not good old 8 bit ASCII. More likely 16 bit unicode stuff. UTF-16 or what ever its called. Then you need the Parallax font to get things like the schematic symbols to show properly.
    Try using the Linux "file" command on a .spin file to see what it is.
    First thing I do with spin files is to get rid of all that nonsense by running them through iconv so that I can view/edit them with regular text editors under Linux.
  • localrogerlocalroger Posts: 3,452
    edited 2012-06-17 14:02
    The PropTool uses both unicode and ASCII. It defaults to ASCII unless you use extended characters, such as the schematic characters, which require unicode.
  • msrobotsmsrobots Posts: 3,709
    edited 2012-06-17 14:07
    yupp, Proptool even warns you while saving.

    Enjoy!

    Mike
  • SRLMSRLM Posts: 5,045
    edited 2012-06-17 16:55
    Heater. wrote: »
    First thing I do with spin files is to get rid of all that nonsense by running them through iconv so that I can view/edit them with regular text editors under Linux.

    Thanks for the hint. In the past I've just opened the file and copied all the text into a new file. I don't like the binary file formats: they have a tendency to crash my text editor.
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-06-17 17:36
    Spin files can be editted with most anything. I have even used Notepad on windoze - Notepad is great to print out some of the code.

    I just downloaded an Android editor called "920 Text Editor". It opened and displayed a spin fle correctly - my 1pin TV which uses the extended char set. I have a Xoom.

    My biggest problem is how to position the cursor over text I wish to change in Android. Anyone found this problem and a solution?
  • rosco_pcrosco_pc Posts: 468
    edited 2012-06-17 18:44
    Cluso99 wrote: »
    My biggest problem is how to position the cursor over text I wish to change in Android. Anyone found this problem and a solution?

    Press your finger on any text field will present you with a 'slidable' cursor.
    Long press on a word will select the word and present 2 slidable cursor, allowing to change the selection
    This needs some practice, but works quite nicely

    Written on my Asus Transformer :) .

    [Added] The long press can be used to select/copy/cut/paste ANY text. You might want to look into installing the hackers keyboard :D

    [Added 2] Cool 920 supports VIM syntax highlighting. So you can easily add SPIN syntax highlighting :0
  • Heater.Heater. Posts: 21,230
    edited 2012-06-17 21:14
    Rosco_pc,
    You maybe intending a little humor with your suggestion of vi syntax highlighting for Spin but it does exist.
    Have a search for the thread "Spin syntax definition for vim" by Andrey Demenev". It has been very usefull for me.
  • rosco_pcrosco_pc Posts: 468
    edited 2012-06-17 21:23
    Hi Heather,

    No humor intended, I like and use VIM. The reason I had a smiley, was precisely because of that vim syntax from Andrey (see also the Spin android Tool thread, you can see I have been running Vi :)


    PS I travel alot since I moved to Taiwan, so getting some 'propeller time' is getting difficult. Being able to use my tablet is making it easier to get something done again.
  • Heater.Heater. Posts: 21,230
    edited 2012-06-17 21:33
    That's "Heater.".

    OK. Let's keep the vim flag flying.
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-06-17 21:48
    Thanks Rosco for the editting tips. Seems I need to read up on this. I have seen the green highlighters come up but didn't know what to do with them. RTFM applies :(
  • rosco_pcrosco_pc Posts: 468
    edited 2012-06-17 21:51
    Heater. wrote: »
    That's "Heater"

    Oops sorry for that
  • Heater.Heater. Posts: 21,230
    edited 2012-06-18 04:48
    Cluso,
    Spin files can be edited with most anything.

    Except for UTF-16 Spin files under Linux:

    1) The "less" command warns you may have a binary file and displays gibberish if you continue.
    2) The "diff" command does not work, just says tells you that binary files differ.
    3) The "grep" command cannot be used to find anything. Or perhaps tells you the binary file contains the search string, but where?
    4) The "sed" command does not work, so no quick global replacing of strings from the command line.
    5) Amazingly "cat" works except some characters are gibberish.
    6) Source code repositories like svn and git have trouble working with what they see as binary files, mostly because "diff" does not work. I believe there are work arounds for this but it's a pain anyway.
    7) The vim editor will open the files and display gibberish.
    8) The kate editor from KDE will open the files after you have figured out to turn on file type auto detection.

    All in all UTF-16 Spin files are a pain and I don't think anything other than byte wide chars has any place in a programming language source code.
    Having to have weird fonts for graphical drawing chars in a source file is just a bad idea.

    Now you might say that all those tools I mentioned need fixing but that just stuffs up the whole UNIX byte stream pipe philosophy for no useful purpose, blech.
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-06-18 16:57
    heater: I don't see your problem - I only use windoze (tongue in cheek :))

    But really, I thought the character set was a great idea for being able to insert circuits into the source code.I have stopped using the special graphics for banners now.
  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-06-18 17:10
    It would be fine if PropellerTool used either utf8 or the Propeller native character set.
  • RinksCustomsRinksCustoms Posts: 531
    edited 2012-06-18 18:17
    wow.. lotta knowledge, thanks for the responses. The end goal is to have a functional editor for use on tablets as well as phones that support host mode (like RAZR MAXX -rooted) :)
Sign In or Register to comment.