GNAT GPS on the fly syntax checking and getting the best out of the IDE - ada

I've started using GPS for coding Ada at work - does anyone have any tips for getting the best out of the IDE? or any plugins I should be aware of?
For example is there a way to enable on the fly syntax/type checking - of the sorts you get in eclipse/visual studio where errors are underlined as you go?
Also what are people's general opinions on GNAT Workbench compared to GPS?
thanks
Matt

The GPS does not have a from of background syntax checking and that is by design. The idea behind GPS is that it is the compiler who decides what code is correct and what code is not correct. It means that if you want to know if your code is correct or not you have to compile it. On a Windows computer the short cut key for that is SHIFT+F4 and will only compile the specification or body file you are currently editing. Pressing F4 will compile your whole project. You will save time by using SHIFT+F4.
Another interesting feature is that the GPS uses cross-reference (XREF) information when navigation through the code. For example, let's say you would like to find all the places in your code where a specific subprogram is called. In GPS (GNAT PRO), right click on the subprogram you are interested in a press Find references. In the GPS GNAT Libre version you don't have a menu when right clicking in your code. In this case go to the Navigate menu and click on Find references there. If the GPS does not find any references and you know that the subprogram is used in the application it means that the XREF information needs to be updated. You may compile the whole application by F4 since the XREF information will be generated along with the binary that is produced. If you go to Edit and click on Key shortcuts you can set up a short cut key to generate the XREF information only. You may also find several interesting features there that you can set up a short cut key for.
The cross-reference information (XREF) is also used for refactoring (GNAT PRO specific functionality). It often works well for changing variable and subprogram names. Just make sure the cross-reference information is up to date!
Code snippets in GPS are also useful. You use them by writing a keyword followed by CTRL+O (not zero, O as in Orwell). To see the code snippets you can choose between go to Edit and click on Aliases. You can also create your own Aliases and code snippets to become a more productive Ada Software Engineer.
Good luck!

I do not think that GPS has a form of background syntax checking like Eclipse does, at least I haven't found it.
I wrote a small sized terminal program in GPS as my first Ada program and my opinion of it is generally negative.
The browser is very confusing and it is hard to find items you are looking for.
The editor has the nasty habit of adding a column to the left and removing it dynamically based on the item under your mouse. What that does is when you are trying to select text with the mouse, your text switches right and left by one character as you move which makes precise selection a difficult thing to do
Getting in the debugger involves too many steps and it generally moves your files in the editor to the EOF position when you set breakpoints, so you will do a lot of scrolling to go back to the sections of interest.
The debugger output looks fancy with all the graphical elements but it is also cumbersome to operate.
GPS offers better help features for Ada libraries though, it's generally easier to browse the standard libraries and check them out than in Eclipse.
All in all, if Eclipse works for you, you might want to stick with it or perhaps open both on the same project and switch to GPS for things like help etc.
I had a related question out here which is on hold now (as I expect your question will soon be due to it's broad content) but I did some research and I am generally dissatisfied with what is out there in the Ada field. The language is great but it suffocates under bad tools.
One last tip: You might want to try Slick Edit as it's text editor and browsing features are quite good, although they too have flaws with Ada (for instance the beautifier).
Good luck with your venture

Related

VSCode : mvbasic extension on editing Unidata code with MV marks in code, ie CHAR(253), CHAR(254)

I have searched for a setting within the mvbasic extension within VSCode but I may have hit a dead end. I am new to using VSCode with the rocket mvbasic extension and still in the learning process, so please bear with me.
Our development for the most part has always been directly on the server using the editor within it to code and develop on a Unix/Aix platform with Unidata. Some of our code has array assignments with CHAR(253)/CHAR(254) characters within them. See the link to the image that shows how its done. Now I didn't do this code, the original software developer did this many many years ago and we just aren't going to go and change it all.
How code looks on actual server
The issue is when pulling the code to edit in VSCode, the extension is changing it, and I uploaded it back and didn't pay attention and it was implemented in our production incorrectly, which created a few bugs.
ALIST="H�V�P�R�M�D"
How code looks in VSCode
How code looks after uploaded back to server from VSCode
Easy to fix, no biggie, but now to my question.
Does anyone have this issue, or has a direction to point me into that maybe I need to create a setting to keep the characters in the correct ASCII format so that this doesn't happen again by mistake?
VSCode defaults to the sane choice for character encoding in 2022: utf-8, but sometimes you have to deal with legacy stuff.
https://code.visualstudio.com/docs/editor/codebasics#_file-encoding-support
If you click on the UTF-8 in the bottom right corner you can choose "Reopen with Encoding":
After that, you can select a different encoding. I chose DOS (CP437) at a guess and literal MV characters are displayed as superscript 2 (²), and for me I can save to the server and confirm those characters remain as #VM after a round trip (though for my terminal emulator they appear as } which is useful).
You can edit preferences and set "files.encoding": "cp437". One other thing that can be helpful if your programs don't have a standard extension (like .bas) as most don't is to set the default mode to basic so most of what you're editing will identify as MVbasic, and you can do a quick CTRL-K M to switch to any other modes if you're just pasting in something else like SQL.
Some useful links - the Rocket forums are helpful and the folks there are always super nice
https://community.rocketsoftware.com/forums/multivalue?CommunityKey=521bce2e-71d5-4d32-b560-dfa95e950eb5
The MV Extensions Community extension is a good group and always has been helpful when I've had issues. I've made some small contributions - they're very open. I prefer this extension, but honestly haven't done a deep comparison.
https://github.com/mvextensions

Static data storage on server-side

Why some data on server-side are still stored in DBC files, not in SQL-DB? In particular - spells (spells.dbc). What for?
We have a lot of bugs in spells and it's very hard to understand what's wrong with spell, but it's harder to find it spell...
Spells, Talents, achievements, etc... Are mostly found in DBC files because that is the way Blizzard did it back in the day. It's true that in 2019 this is a pretty outdated way to work indeed. Databases are getting stronger and more versatile and having hard-coded data is proving to be hard to work with. Hell, DBCs aren't really that heavy anyways and the reason why we haven't made this change yet is that... We have no other reason other than it being a task that takes a bit of time and It is monotonous to do.
We are aware that Trinity core has already made this change but they have far more contributors than we do if that serves as an excuse!
Nonetheless, this is already in our to-do list if you check the issue tracker at the main repository.
While It's true that we can't really edit DBC files because we would lose all the progress when re-extracted or lost the files, however, we can modify spells in a C++ file called SpellMgr.
There we have a function called SpellMgr::LoadDbcDataCorrections().
The main problem while doing this change is that we have to modify the core to support this change, and the function above contains a lot of corrections. Would need intense testing to make sure nothing is screwed up in the process.
In here by altering bits you can remove or add certain properties to the desired spells instead of touching the hard coded dbc files.
If you want an example, in this link, I have changed an Archimonde spell to have no cast time.
NOTE:
In this line, the commentary about damage can be miss leading but that's because I made a mistake and I haven't finished this pull request yet as of 18/04/2019.
The work has been started, notably by Kaev. I think at least 3 DBCs are now useless server side (but probably still needed client side, they are called DataBaseClient for a reason) like item.dbc.
Also, the original philosophy (for ALL cores, not just AC) was that we would not touch DBC because we don't do custom modifications, so there was no interest in having them server side.
But we wanted to change this and started to make them available directly in the DB, if you wish to help with that, it would be nice!
Why?
Because when emulation started, dbc fields were 90% unknown. So, developers created a parser for them that just required few code changes to support new fields as soon as their functionality was discovered.
Now that we've discovered 90% of required dbc fields and we've also created some great conversion tools for DBC<->SQL, it's just a matter of "effort".
SQL conversion is useful to avoid using of client data on server (you can totally overwrite them if you don't want to go against EULA) or just extends/customize them.
Here you are the issue about DBC->SQL conversion: https://github.com/azerothcore/azerothcore-wotlk/issues/584

Directshow advice for range of functionality or is there a better alternative (.NET)?

I've been doing some work in VB.Net with Directshow over the past 3-4 weeks. I'm creating an application to keep tags on a video and eventually want to be able to extract the tagged parts of the video to a new file. In a video that is 2 hours long I might want to extract say 50 10-15 second "clips" up to 15 times (event tagging). This will be for a free application.
I've found it brilliant (and easy) to render / seek / play clips, etc on XP-Win7 with no issues. I've "discovered" the joys of GraphEdit, creating graphs, the issues with COM in VB.NET, GMFBridge, ....etc.
Now I need some advice. Am I using the right technology. Directshow seems to be very resistant to the idea of "open video", "seek to clip", "write clip to file", .....repeat for all clips, close file. I can sort of do this already if I visibly render the video but would need to do it as a background task faster than realtime render speed.
Things that seem to be missing are:
- an example of anyone doing anything similar (export multiple clips to a single file)
- no easily available 64bit compressors (lots of 32bit stuff around)
- all the references and examples I do find are VERY old
- VB.NET is not the first "port of call" for DirectShow developers
So, the question is, should I be using something else?
If not, has anyone done anything similar before. I'm not looking for their code, I just want some guidelines as it takes ages to figure things out in DirectShow and VB.Net just using trial & error (and Google).
I've looked at AFORGE (no sound), FFMPEG (command line toolset), Media Foundation (reluctant to throw away XP) and a variety of commercial helper libraries but not really getting any further.
Apologies for the length but I wanted readers to understand the background.
All help appreciated.
To output clips to a single file Microsoft had created the "DirectShow Editing Services". Sometimes it works, sometimes not. We use it in our software to create videos from clips like you. With a little bit work you can also include effects to the video.
It is also possible to use AviSynth. It's a scripting system and frameserver for DirectShow.
As I know, with MediaFoundation you can also create a video from multiple clips, but I never tried this.

Library or advise on plotting box nodes interactively

I'm building an application that parses text files that contain information about specific nodes with incoming ports and outgoing ports that are interconnected. Doing some research there are some libraries but none of them support the exact characteristics needed.
this is what I'm trying to build and any language will do: Python, Perl, .net, etc.
One of the libraries I have found is GoDiagaram Node Classes
http://www.nwoods.com/components/dotnet/features-nodes.htm
The idea is to have boxes like so, interconnected and I should be able to click on one of them and link it to a new sub-diagram with more boxes contained in the one clicked.
Is there a counter part of these kind of charts that is opensource? and do these diagrams have a specific kind of name?
I don't know any specific details, since I never looked into this too closely, but here are some potential directions:
The data structure used for representing something like this is usually a graph (probably a directed graph). You could also try searching for graphical (or visual) programming languages. I seem to remember Pure Data as one that was relevant, but I never looked at it in detail.
Blender and VirtualDub both have a mode that's similar to this (the node editor and audio filters, respectively) and I believe both are open source, although I think neither has the option of having the nodes contain other nodes internally.
You could just use LabVIEW, which gives you the ability to create and edit LV code programmatically (search for "VI scripting"), but the code for that might not be very pretty and it's certainly not open source.

Documentation Generation - What boxes should I aim to tick?

I'm looking at requiring my team to document their code more thoroughly for some major upcoming projects and to make life a little less painful, I am steering towards XML documentation generators such as Sandcastle, Doxygen or Box Live Documenter.
What are the key considerations I should keep in mind when evaluating the best option and what experiences have led you to a particular decision?
For me the key considerations would be:
Fully automated: Can it be set up in such a way so that pretty much
no outside work is required to
create or edit the documentation.
Fully styled: Can the documentation be fully styled so
that it looks great in a wiki or pdf
after it’s generated. I should be
able to change colors, font sizes,
layouts, etc.
Good Filtering: Can I select only the items I want to be
generated. I should be able to
filter the namespaces, file types,
classes, etc.
Customization: Can I include headers, footers, custom elements,
etc.
I found Doxygen could do all of this. Our workflow is as follows:
Developer makes a change to the code
They update the documentation tags right above the code they just changed
We click a generate button
Doxygen will then extract all the XML documentation from the code, filter it to only include the classes and methods we want, and apply the CSS styling we’ve pre-made for it. Our end result is an internal wiki that looks the way we want, and doesn’t require editing.
Extra: We have all our projects in various git repositories. We pull all these down to one root folder and generate the docs form this root folder..
Would be interested to know how others are automating even further..?
Who is paying for the documentation and why? (is the system stable enough, does it add enough value)
Who is going to read it, and why is she not using a more effective communication channel?
(if correct mostly distance in time/place)
Who is going to keep it up to date.
When are you going to destroy it? (Automatically if it hasn't been read or updated in the past three months?)
I mostly prefer better code to make my life less painful, over more documentation, but I like scenario & unit tests and a high level architecture description.
[edit] Documentation costs time and money to write and keep up to date. JavaDoc style documentation has a serious detrimental effect on the amount of code simultaneously visible and might be a good idea for the developers using the code, but not for those writing it.

Resources