English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. Blitz Basic (https://eab.abime.net/forumdisplay.php?f=126)
-   -   BB2 User Defined Language for Notepad++ (https://eab.abime.net/showthread.php?t=86316)

MickGyver 09 March 2017 11:10

BB2 User Defined Language for Notepad++
 
3 Attachment(s)
Hello! Since it's possible to share the clipboard between WinUAE and Windows I decided to start making a user defined language for Blitz Basic 2 in Notepad++. So far I have just done the basics and only a few keywords are there yet. Having to copy-paste code to Ted in WinUAE is of course an extra step but coding in Notepad++ is otherwise so much smoother (line numbers, code folding, region support, better colours, proper mouse wheel and a lot more)

What do you think? Is this a stupid idea? :)
------------------
EDIT: I have worked out a good way to use Notepad++ with BB2. Here are the most up to date files and instructions (also attached, look at the end of post):

Instructions
http://gamephase.net/files/linked/bb...screenshot.png
http://gamephase.net/files/linked/BB...HowTo-v1.4.pdf (updated: 2019-02-09)

User defined language
http://www.gamephase.net/files/linked/BB2-NPP-v1.0.zip

Automation tools
http://www.gamephase.net/files/linke...-tools-v10.zip

http://gamephase.net/files/linked/bb2-npp-1.png

Daedalus 09 March 2017 12:53

I think it's a great idea :) Good stuff!

idrougge 09 March 2017 16:14

Feel free to use these scripts for a smoother experience: http://eab.abime.net/showthread.php?t=77610

MickGyver 09 March 2017 16:14

Ok! Now I have added all the commands and functions from the reference manual of Blitz Basic 2 (newer commands from extensions are currently missing). I also started making an auto-completion file, it has all the commands. A few functions also have descriptions etc. but only functions that user parentheses can have descriptions + parameter lists.

I have attached the files here so you can try it out. Please report any problems or suggestions to me in this thread! In the zip file there is a text file describing how to install, it's a very simple procedure.

http://gamephase.net/files/linked/bb2-npp-2.png

http://gamephase.net/files/linked/bb2-npp-3.png

MickGyver 09 March 2017 16:52

Quote:

Originally Posted by idrougge (Post 1145756)
Feel free to use these scripts for a smoother experience: http://eab.abime.net/showthread.php?t=77610

This looks good, thanks for the tip!

Amiga1992 09 March 2017 16:59

Excellent idea, I love Notepad++!

MickGyver 09 March 2017 17:49

Seems that it is more convenient to save the source file directly to the virtual harddrive used by WinUAE and then re-loading the source manually in SuperTed and compiling. I looked at the thread idrougge suggested and made an arexx script like this:

Code:

/* blitz.rexx */
address TED_REXX1
SHOWSCREEN
WINDOWTOFRONT
ACTIVATE
LOADNEW 'WB31:Blitz2/Projects/Test/test.bb2'
COMPILE

So with SuperTed open it's possible to run the rx script from the shell to reload the source and compile. Is there a better way to run an arexx script, like a keyboard shortcut directly in SuperTed or something similar?

By the way, the source files need to have only the LF character for new lines, you can verify / change to this in Notepad++: Edit / EOL Conversions -> UNIX/OSX Format . It also seems that there needs to be a new line at the end of the source file.

idrougge 10 March 2017 07:16

There are UAE utilities to run Amiga commands from the PC environment so you can integrate it with your editor.

attle 10 March 2017 09:22

witchmaster: Here's a list of blitz2 keywords, may be useful to you: https://github.com/grovdata/pyblitz2...er/test/kw.txt

MickGyver 10 March 2017 09:37

Quote:

Originally Posted by idrougge (Post 1145896)
There are UAE utilities to run Amiga commands from the PC environment so you can integrate it with your editor.

Thanks for the tip! I'm looking into this now. I asked about this in the WinUAE support forum since I couldn't find any good info about how to do this.

Quote:

Originally Posted by attle (Post 1145905)
witchmaster: Here's a list of blitz2 keywords, may be useful to you: https://github.com/grovdata/pyblitz2...er/test/kw.txt

Thanks, they will indeed! :)

Retro1234 10 March 2017 15:16

Whens the Amos version :blased

MickGyver 10 March 2017 17:12

Quote:

Originally Posted by Retro1234 (Post 1145951)
Whens the Amos version :blased

If you can give me a list of the keywords for Amos I can make an Amos version also, no problem.

tolkien 10 March 2017 21:44

What a good idea. I was thinking in doing the same with CubicIDE but dont know how to start.
Will try this. Thanks!

idrougge 11 March 2017 14:32

You can also use your deflibs file (or something like that) to read out a list of all your available commands, complete with tokens and help text.

tolkien 11 March 2017 15:03

Interesting idrougge. Will try later if I can use it.
Thanks mate!

MickGyver 11 March 2017 21:05

Now there is also a working function list, wohoo! :)

http://gamephase.net/files/linked/bb2-npp-4.png

P.S. Don't mind the parameters...

Cylon 12 March 2017 02:28

7 Attachment(s)
Here are some outputs of viewcmds tool. Maybe useful.:)

MickGyver 13 March 2017 17:57

Quote:

Originally Posted by Cylon (Post 1146306)
Here are some outputs of viewcmds tool. Maybe useful.:)

Thanks! These are included as keywords now.

I have now finished a version that seems to work quite well. Keywords from the sources above are included (about 2800 in total). Code folding is working (if you save files with CR LF end of line characters, read about this in the howto text file).

Features
- A majority of keywords (about 2800) should be highlighted and suggested (auto complete)
- Function list shows statements, functions and labels.
- Folding of statements, functions, loops, multi-line comments.
- Foldable regions can be defined. example:
Code:

; region @init
[code goes here]
; }


I will include info about automating things later. I have managed to get the building process semi-automated.

MickGyver 13 March 2017 19:06

EDIT: Don't set up automation according to this post, there is an easier and smoother way, I will soon write a post how to do this.

Setting up semi-automation of the build process
------------------------------

Blitz basic 2 has an AREXX port so it's possible to automate it using AREXX. You can take the following steps to set things up.

1. In WinUae set serial port to TCP://0.0.0.0:1234 and select "Direct" below the drop down box. Save the WinUAE configuration and quit WinUAE, add the following to the configuration file manually (inder the other lines concerning serial): serial_translate=crlf_cr

2. Create the file DEVS:MountList on the virtual harddrive with following content (if it does not already exists)

Code:

AUX:
Handler = L:Aux-Handler
Stacksize = 1000
Priority = 5

3. Add the following commands to the end of S:user-startup

Code:

mount aux:
newshell aux:

4. Create a file named blitzproject.rexx in S: with following content (change blitzproject to the name of your project and change the LOAD command to point to your source file). You will need to create a separate script for every project (just copy an existing one and change the source file path).

Code:

/* blitz automation */
address TED_REXX1
SHOWSCREEN
WINDOWTOFRONT
ACTIVATE
LOAD 'WB31:Blitz2/Projects/Test/test.bb2'
COMPILE

5. Download and install Putty and the NppConsole plugin for Notepad++. Choose to add the Putty installation directory to the PATH variable so you can start it from anywhere.

6. Start Putty, create a Telnet connection to 127.0.0.1 at port 1234. Uncheck Connection / Telnet / Return key sends Telnet New Line instead of ^M . Save the connection with the name WinUAE.

7a. If you are using the Code Fold version of the BB2 UDL for Notepad++ you might want to download my command line tool that can convert EOL (end of line) characters from CR LF to LF that is required by Blitz Basic 2. Get it below (save the exe file to your Windows directory): http://www.gamephase.net/download/831/

7b. Create a .bat file in the same folder as your BB2 source file, with the content (destination is your project file path in the virtual harddrive):

Code:

ConvertEOL unix "source_file_path" "destination_file_path"
7c. Just a note when using this setup: You will edit separate versions of the BB2 source files on your Windows harddrive, the ConvertEOL tool will be set up to copy the source file to the virtual harddrive set up in WinUAE.


Using the semi-automation
------------------------------

1. Start WinUAE, load your configuration and start the emulation, then run Blitz Basic 2.

2. Show the NppConsole in Notepad++ and run the command: plink WinUAE
(You may need to press enter a few times for the shell prompt to show)

3. Edit and save the Blitz Basic source file in Notepad++. If you are saving your source file with CR LF end of line (with code folding) then press F5 and choose the .bat file you created in step 7b previously. This will convert the CR LF to LF and save the source in the BB2 project folder.

4. In NppConsole (remote shell) write "rx blitzproject" (without quotes) and press enter. Blitz Basic 2 should now reload the source file, compile and run. (blitzproject is the name of the AREXX script created earlier).

idrougge 13 March 2017 19:38

You can make do with just one script if you just specify the sourcefile on the command line:
Code:

/* blitz automation */
address TED_REXX1
SHOWSCREEN
WINDOWTOFRONT
ACTIVATE
LOAD ARG(1)
COMPILE

ARexx can also be used to remove CR/LF (why is that even needed?) using the Strip() function.


All times are GMT +2. The time now is 17:51.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.05343 seconds with 11 queries