[Tool]FemtoIDE

release
tool
open-source

#181

When I started the compiler, all of the code generated was for TDD on the desktop. Pokitto, and the fixed points optimization, came afterwards.

Now things have reversed: It has been a long while since I’ve used the desktop target. It’s probably broken by now.

True. That file needs some cleaning up. Especially the multitude of __add__ overloads.


#182

Makes sense.

Is it even still needed?

I’d try to help out with that, but I’m a bit more concerned about breaking the back-end than the Java-end since there’s more that can go wrong and less that I know about.

Now I think about it, if the compiler is using C++17 then you can get away with namespace up_java::up_lang { instead of needing nested namespace specifiers.


Before I go too nuts with the documenting, does this branch still compile?

I don’t actually know of a way to test my changes so I’m mostly flying blind at the moment when it comes to ‘does this work?’.

If that works then I can move on to the others.

I know the femto stuff is probably more useful to have documented,
but I’d be mostly guessing for anything that wasn’t already documented in the Wiki,
and I’m pretty sure I covered a decent chunk of what was in the Wiki already.


#183

Great, sound effects are working! Any estimate of the release date? :wink:


#184

Eventually I’ll go back and get it working again. It will be useful if people want to get their games running on their PC or in a browser without an emulator.

Neat, I didn’t know C++17 had that. :slight_smile:

Seems OK, once you change the vfs entry. Just be careful not to rename an argument in a stub function, otherwise the implementation is going to break (see atan2).

You could… try running it? :stuck_out_tongue:


It’s already on github, if you want to go “bleeding edge”.
Here’s an example of what the API looks like:

import femto.input.Button;
import femto.palette.Psygnosia;
import femto.font.TIC80;
import femto.Game;
import femto.State;
import femto.sound.Mixer;

class Main extends State {
    // These are wav files
    S1 s1;
    S2 s2;
    S3 s3;

    public static void main(String[] args){
        Game.run( TIC80.font(), new Main() );
    }

    void init(){
        // create an instance of each sound
        s1 = new S1();
        s2 = new S2();
        s3 = new S3();

        // put each one on its own channel so they don't cut each other off
        s1.channel = 0;
        s2.channel = 1;
        s3.channel = 2;

        // Initialize the Mixer at 8khz
        Mixer.init(8000);
    }
        
    void update(){
        if( Button.B.justPressed() )
            s2.play();

        if( Button.Left.justPressed() )
            s1.play();

        if( Button.Right.justPressed() )
            s3.play();
    }
}

I’d like to release 17b by the end of tomorrow, we’ll see how it goes.


#185

Looks very neat and simple! I will try it tomorrow.


#186

Clearly someone on the comittee had an “hang on a minute, why aren’t we already doing this, this should be really easy” moment. :P

(Kind of like when someone suddenly realised std::clamp would be really useful.)

Ah, you should have told me that before.
I was trying to match the argument names to the standard documentation.
I’ll probably have to fix a few in String.java.

Searching for *.exe returns zero results…

A version of the constructor that accepts a channel index might be handy for halving the code size.


I’m currently working on writing a script for updating the Doxygen output.
I’ve got a working batch version, I just need to write a bash version.

It clones the main repo and the repo the documentation is hosted on, runs doxygen, copies the files, changes to the gh-pages branch, commits and then pushes.
And then possibly there could be a cleanup script for after?

git push needing logon info is a pain though.

Edit:
If anyone is brave enough to trust my ability to script for operating systems I’ve never spent more than 10 minutes using:

If you do try it, please remember to replace https://github.com/Pharap/FemtoIDEDocumentationExample.git and FemtoIDEDocumentationExample with your own repo URL and name, otherwise you won’t have much luck with git push. :P


#187

v0.0.17b released

  • FemtoLib: Sound effects
  • Java: No more stack overflow when using a missing class
  • Java: Better error messages
  • Java: Fixed bug with final objects
  • Java/FemtoLib: code commenting thanks to @Pharap
  • IDE: Highlight current file in tree
  • IDE: Initial Jump-to-definition support

#188

Oh, right. I didn’t put nwjs in the repo because it’s huge and platform-dependent.
The easiest way would be to download a release then copy/move the repo onto it.


#189

Your friendly and weekly bug report!

Java - Enums cannot be declared and a cryptic error will be logged instead.

  • I’ve seen a bug report about how they have to be fully implemented (https://github.com/felipemanga/FemtoIDE/issues/22). I assumed they still worked for simple comparisons, aka if (value == Enum.VALUE) etc.
  • But even simply declaring an enum with a few values and doing nothing else will show weird errors.

Build - Random getSession() error will break build tools.

  • When it happens, no build tool with work again until the IDE is restarted.
  • This one is kind of weird because I can’t reproduce it at will. I suspect it’s an expired session issue, given the fact it tends to happen when I’m busy with something else, but I’m not even sure.

Editor - Pasting a text that is exactly the same as the current selection won’t clear up the selection.

  • When copy-pasting something, if the pasted content is exactly the same as the current selection, nothing will happen, including the selection change that usually happens after a paste.
  • For example, select in your main() method the token Game, copy and paste it - nothing will happen. However you can still paste it everywhere else, as long as the current selection isn’t exactly Game.
  • This one is more of a minor annoyance than anything else. It annoys me when I have to duplicate some lines - e.g. for emulating enums with static final int.

Editor - Opening a PNG file will modify it somehow.

  • The image itself will appear to be the same, yet the binary content will be different.
  • It’s a bit annoying because, so far as I can tell, there is no way to put images in a separate folder.

Java - Automatic casts seems to be done in java, but will produce errors in the generated CPP.

  • I’ve seen that while trying to ++ a boolean.
  • Thing is, it’s really annoying when it’s showing the generated C++, as there are no hints about what happened.
  • Also, it seemed for me that after a few errors of this kind, the shown generated C++ is actually an older one.

I’ve also had some other bugs, but I forgotten them for now!
Anyway, thank you for your hard work, making this happen is sure a difficult thing that I wouldn’t be able to pull off by myself!


#190

Hey, thanks for the report!

Just today I was looking into enums. It’s possible the exact bug you’re seeing was already fixed.
Can you paste the code you couldn’t get to work?

Are you seeing this on release v0.0.17b?
A bunch of getSession errors were fixed on the last release. Sessions don’t expire, btw.

I hadn’t noticed this. Fixed.

That’s because Piksel reports that the image was altered when it loads, so the IDE auto-saves it. Since PNG isn’t lossy, it shouldn’t be a big problem, but I can see how it’d be annoying if the file is under version control.

You can’t move files in the list yet, but you can use your OS’s file explorer to organize them.
I didn’t understand how the autosave issue is related to this.

A lot of Java’s type checking rules haven’t been implemented yet, so instead of giving you a nice error message when your code is wrong (you can’t ++ a boolean, it’s forbidden in Java and deprecated in C++), it happily emits the code in hopes that C++ will figure out what to do.
When C++ detects an error, the best hint it can give is what appears in the log.
As I continue to implement error checking, the tendency is for this to happen less.

I’ll have to look into why it’s showing an older C++ file. :thinking:


#191

My pleasure!

Oh really, just add some basic enum and you’ll get the error:

enum Animals
{
  CAT,
  DOG,
  SQUIRREL
}

This will trigger the weird error. Additionally, using the declared type will give your other kinds of errors as well.
The error seemed to contain parser information too.

Yes, but it’s very random. It did happen like within the first hour, then not anymore on the two others, out of the 3 hours I spent today on this.

Well it’s more related to the fact I tend to miss-click because images, codes and other files are mixed in the same folder and since I like to split my code in multiple files, it’s becoming crowded in that list haha

Yeah definitely! The more errors the transpiler catches, the best it’ll be.
Also, I know for the boolean, but sometimes while thinking about two things I mix them together :stuck_out_tongue: this also happened when I had issues with the final / const too
Also a suggestion I have is to add some comment in the generated code telling from where it’s generated (e.g. // Cat.java:56 - meow() method), if possible?

Thanks!!


#192

I do not know if it was supposed to be, but there is no “stage all & commit” item in the git menu.


#193

I’ll have a look into it at some point. Probably won’t be until later, might not be for a few days, it depends.
(I’ve grabbed a copy at least.)

By the way, did you test either of my scripts and/or do you have a place in mind for hosting the documentation?

And removed in C++17.

-- on the other hand has never worked on bool.
Allowing ++ in the first place was probably a stupid idea.
If the intent is to set a variable to true, set it to true,
that’s what the compiler would be doing anyway.
(++ on a bool can’t actually compile to ++ because it would break for static_cast<bool>(~0).)

In other words, @carbonacat this isn’t a bug, this is a feature,
you should not be trying to ++ a bool in the first place, it’s just asking for trouble. :P


#194

Ahah we wouldn’t need errors or even any checks or safety at all if we didn’t get into trouble by ourselves without willing to. I never ++'d a boolean before, I didn’t even knew it was deprecated in c++.

Also I think I tend to rely heavily on auto-completion and live information when coding on my main IDEs, and using an IDE that doesn’t provide any of those will leave my brain struggling a bit because it has to pull that work again haha


#195

Is it hard to tell where it’s from? A meow method in a Cat class becomes a uc_Cat::meow method in C++. :thinking:


I didn’t add it yet, there were some problems with it so I left it for the next release.


I’m thinking of putting the documentation in the build and having the IDE display it.
I could put it in gh-pages, but first I’d like to have a simple site there, and that would link to the docs.

Unless you count the time when C used #define bool char


#196

To err is human.

Personally I think that’s a good thing in a way.

I honestly think in some ways having a less sophisticated tool helps improve programming ability because it forces you to think more about the language’s grammar instead of relying on the computer to do it for you.
(Much like how not relying on a calculator can improve your mental arithmetic.)

When I started doing Arduino stuff I started using Notepad++ to write code a lot more often.
Since then I don’t make daft mistakes (like forgetting semicolons) as often as I used to.

I’m not saying we should all write code in Notepad, but sometimes ‘going native’ can be a good exercise.


You could just put it on gh-pages for now and worry about tarting it up later.

Otherwise I can keep hosting it for the time being.
As long as there’s a way people can access it.

The less said about C the better. :P

80% of C++'s less helpful nuances can be boiled down to “C++ does it that way because C did it that way”.


#197

Yeah, probably best to do that. The next release is going to take a while to come out anyway.


#198

The next version of FemtoIDE has a good surprise for you then. The auto complete and hinting is great!


#199

Looks like I won’t exercise for long, @Pharap :laughing:


#200

Drat. :P