Pages: 1
  Print  
Author Topic: Segfalt with enigma compiler  (Read 10413 times)
Offline (Unknown gender) TGMG
Posted on: December 29, 2010, 09:44:42 am

Developer
Joined: Jun 2008
Posts: 107

View Profile WWW Email
Since I haven't been able to run enigma games on macos or iphone/android recently I decided to test how well the compile process works up to the running stage. I am really impressed with how well the enigma compiler works at the moment, with a small edit to the compiler and a definitions file which contains the empty functions that are needed for the game I was able to almost compile and link all of them. They do require certain modifications (see the errors I posted on tracker recently) such as removing switch statements, editing some of the actions, changing resource names, changing all '=' to '==' in expressions etc

So first the games that I was testing are the top 10 most downloaded on 64D:
1) Platform shooter works (works but have to change = into ==)
2) Online engine works but not server (works but requires commenting switch statements!)
3) gceffects engine (has a variable called write/index! didn't finish replacing all variables)
4) real water (linker error)
5) Jenners platform engine ( works but have to change = into ==,has a variable named free!)
6) Skidmark all (normal and unreg) works (but have to change = into ==)
7) Online highscores (compiles successfully)
8) Dndexample works (drag and drop objects)
9) physics engine v2 (compiles but 2 linker errors sprite_add and _working_directory)
10) segfaults the enigma compiler

I haven't listed all the errors in  the brackets as most have the = to == and require the switch statement removal.

But a few really annoying things kept creeping up, first variable names, alot of game maker games use variables with names like 'index' 'write' 'pow' which won't work in enigma as they have been defined by something else. I gave up replacing all the variable names in the gceffects engine as there was so many.

Another annoying thing is the way people name there resources, some are c++ keywords like 'catch' other contain spaces and more often the sprites have the same name as the objects etc. Which causes a compile error which would be very confusing to new users.

Anyway onto the segfaults, you will need these definitions files to test all of them:
actions: http://enigma.pastebin.com/tBZvy2C6
others: http://enigma.pastebin.com/5JLTHQj8

They also require a change to the enigma compiler:
added to compile.cpp under the rest of them:
Code: [Select]
wto << "enum //font names\n{\n";
    for (int i = 0; i < es->fontCount; i++)
      wto << "  " << es->fonts[i].name << " = " << es->fonts[i].id << ",\n";
    wto << "};\n\n";

    wto << "enum //timeline names\n{\n";
    for (int i = 0; i < es->timelineCount; i++)
      wto << "  " << es->timelines[i].name << " = " << es->timelines[i].id << ",\n";
    wto << "};\n\n";

    wto << "enum //path names\n{\n";
    for (int i = 0; i < es->pathCount; i++)
      wto << "  " << es->paths[i].name << " = " << es->paths[i].id << ",\n";
    wto << "};\n\n";




Now the files:
ackack: http://dl.dropbox.com/u/5072558/segfaulting/ENIGMA_ackackenginev1.7.gm6
server: http://dl.dropbox.com/u/5072558/segfaulting/Enigma_Online%20Engine%20Server.gm6

ackackengine gives:
Quote
Writing modes and settings
Writing object switch
Writing resource names and maxima
Writing events
Checking for default code in ev[2, 0.
Checking for default code in ev[0, 0.
Checking for default code in ev[8, 0.
Checking for default code in ev[6, 50.
Checking for default code in ev[5, 86.
Checking for default code in ev[9, 88.
Checking for default code in ev[6, 4.
Checking for default code in ev[7, 5.
Checking for default code in ev[3, 0.
Checking for default code in ev[7, 10.
Invalid memory access of location 0x28 rip=0x7fff84df19bf

Segmentation fault


online server gives:
Quote
>> Searching for `global` in globj->locals (19 entries)
{ acc_id, argument0, argument1, argument2, argument3, argument4, argument5, argument6, argument7, dll_cdecl, i, keyboard_string, name, pid, servertcp, tcp, ty_real, ty_string, username, end }
Typeless
Invalid memory access of location 0x0 rip=0x7fff84df20aa



Next i'm going to try and look into all the errors that I posted on the tracker and try and fix them if possible, although just the enigma plugin ones related to actions, would have no idea how to implement the parser ones (== and switch statements), and then hopefully do the next 10 which I hope will go much smoother.
« Last Edit: December 29, 2010, 04:11:35 pm by TGMG » Logged
me
GMbed 2.0 :: Embed you gm games in websites.
Offline (Male) polygone
Reply #1 Posted on: December 29, 2010, 10:36:00 am

Contributor
Location: England
Joined: Mar 2009
Posts: 794

View Profile
Is anything planned with LGM to help resolve things like conflicting variable names? Like a smart syntax debugger tool which will search for syntax errors like this then allow the user to perform actions to resolve it (like renaming the variables).
Logged
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
Offline (Male) Josh @ Dreamland
Reply #2 Posted on: December 29, 2010, 11:05:50 am

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
I just fixed that segfault a bit ago, but haven't yet committed it due to an issue that came with it.
I'd appreciate it if you linked to them with their description (should the top 10 change).
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Female) IsmAvatar
Reply #3 Posted on: December 29, 2010, 11:18:52 am

LateralGM Developer
LGM Developer
Location: Pennsylvania/USA
Joined: Apr 2008
Posts: 877

View Profile Email
@polygone: LGM doesn't perform syntax checking, it delegates that task off to ENIGMA, since that's where the competent parser is.
Logged
Offline (Male) Josh @ Dreamland
Reply #4 Posted on: December 29, 2010, 01:39:13 pm

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
Now if only the type coercer were so competent. That's what I get for adopting an even remotely standard method.

...:P
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) polygone
Reply #5 Posted on: December 29, 2010, 03:21:18 pm

Contributor
Location: England
Joined: Mar 2009
Posts: 794

View Profile
@polygone: LGM doesn't perform syntax checking, it delegates that task off to ENIGMA, since that's where the competent parser is.
OK. Would the interface not need to be done by LGM though?
Logged
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
Offline (Unknown gender) TheExDeus
Reply #6 Posted on: December 29, 2010, 03:35:01 pm

Developer
Joined: Apr 2008
Posts: 1860

View Profile
Quote
Another annoying thing is the way people name there resources, some are c++ keywords like 'catch' other contain spaces and more often the sprites have the same name as the objects etc. Which causes a compile error which would be very confusing to new users.
Didn't parser already add prefixed like OBJ_ to objects and SPR_ to sprites? Because in IDE_EDIT you already have things like:
Code: [Select]
variant enigma::OBJ_obj_0::myevent_draw()Thou in IDE_EDIT_resourcenames.h they are without them. I think this should be an easy fix, as just adding easy prefixes for all resource names.
Logged
Offline (Unknown gender) TGMG
Reply #7 Posted on: December 29, 2010, 04:23:44 pm

Developer
Joined: Jun 2008
Posts: 107

View Profile WWW Email
Both segfaults? I'm not sure if both games were due to the same segfault or not but the output looked different. ah yes ofc I have now linked to the 64digits page where I got each example incase the top 10 changes.
Even if lgm had a search tool which searches all the resources for a certain string. I was thinking at one point of implementing an lgm plugin which added some sort of scripting language such as jpython with functions to read and write the resource attributes, to easily implement stuff like this without putting pressure on lgm developers.

It would be useful to have a setting to add 'enigmaVariable_' to all the variables, but that would probably slow down the compiler.

IDE_EDIT_resourcenames.h is the bit I was talking about, the problem with changing them is that all references to them also have to be changed to each variable will have to be checked if it is a resource name and if so append the relevant prefix.
Logged
me
GMbed 2.0 :: Embed you gm games in websites.
Offline (Unknown gender) TheExDeus
Reply #8 Posted on: December 29, 2010, 04:29:50 pm

Developer
Joined: Apr 2008
Posts: 1860

View Profile
Quote
IDE_EDIT_resourcenames.h is the bit I was talking about, the problem with changing them is that all references to them also have to be changed to each variable will have to be checked if it is a resource name and if so append the relevant prefix.
I still doubt its hard, as some Java based obscurer(?) did this too for gmk's. I could be wrong thou, maybe there is some via ass method on how Josh did something and so its hard to implement.
Logged
Offline (Female) IsmAvatar
Reply #9 Posted on: December 29, 2010, 11:38:09 pm

LateralGM Developer
LGM Developer
Location: Pennsylvania/USA
Joined: Apr 2008
Posts: 877

View Profile Email
@polygone: LGM doesn't perform syntax checking, it delegates that task off to ENIGMA, since that's where the competent parser is.
OK. Would the interface not need to be done by LGM though?

What interface? I add a button somewhere that delegates to Enigma's checkForDuplicateVariables method?

JButton b = new JButton("DupVars");
b.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { EnigmaDriver.checkForDuplicateVariables(); } });
add(b);

done.
Logged
Offline (Male) polygone
Reply #10 Posted on: December 30, 2010, 09:39:19 am

Contributor
Location: England
Joined: Mar 2009
Posts: 794

View Profile
I was thinking of something a little more extensive than that, like Word's spelling/grammar syntax tool. But it doesn't matter, I was thinking more long term, I know something like that wouldn't be added any time soon.
Logged
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
Offline (Female) IsmAvatar
Reply #11 Posted on: December 30, 2010, 12:33:13 pm

LateralGM Developer
LGM Developer
Location: Pennsylvania/USA
Joined: Apr 2008
Posts: 877

View Profile Email
something like that would require changes in the behavior of the textarea in order to underline the words or otherwise indicate where problems are. That would be a fair bit more extensive. Once that's done, it would be a simple matter of figuring out some efficient way to perform the check.
Logged
Offline (Male) Josh @ Dreamland
Reply #12 Posted on: December 30, 2010, 03:33:51 pm

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
The hard part is actually doing anything with JEdit. I've been thinking a compatibility tool for GM users would be desirable.

The real struggle is getting people to be aware of the components of ENIGMA that GM simply doesn't offer. They'll have to ease into it, which means lots of compatibility settings. It wouldn't be wise to just replace all comparison = with == upon loading a GM6, because users wouldn't learn anything (they'd still use =, then file a bug report when it failed).

Right now the idea is to have two settings panes saved; one for creating EGM files, another for loading/creating GM6 files. That, however, requires collaboration between ism and myself, so...
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) TGMG
Reply #13 Posted on: December 31, 2010, 07:02:47 am

Developer
Joined: Jun 2008
Posts: 107

View Profile WWW Email
Yes they wouldn't learn anything but enigma should at least warn every time its used other wise it will lead to errors like:
if (speed=0)
Which will compile fine, but will set speed to 0 instead of checking for 0, which is actually very hard to debug, especially when you didn't write the original code.
Logged
me
GMbed 2.0 :: Embed you gm games in websites.
Pages: 1
  Print