Author Topic: Genescript 0.2  (Read 7026 times)

0 Members and 1 Guest are viewing this topic.

Offline Conle

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2203
Genescript 0.2
« on: August 25, 2010, 11:56:40 PM »
Here is a quick update for the graphics runtime library of the N64 port ..
(Note : This has nothing to do with the neo contest edition that's why its posted here)

Updates:
   ~Fixed texture returned id when using more than 1.



Because this bug was actually 1character bug(!) , i thought to show you some code.

Try to spot the bug :

Code: [Select]
static Texture* texture = ((void*)0);
static Texture* textures = ((void*)0);

//Todo : return the address of the block as id
unsigned int load_texture(int slot,int loc,int mirrored,char* filename)
{
Texture* tex = ((void*)0);
Texture* next = ((void*)0);

if(!texture)
{
texture = (Texture*)malloc(sizeof(Texture));
texture->id = 1;
texture->next = ((void*)0);
textures = texture;
tex = texture;
}
else
{
next = textures->next;
next = (Texture*)malloc(sizeof(Texture));
next->id = textures->id + 1;
next->next = ((void*)0);
textures = next;
tex = texture;
}

....
..............
...............

Need help finding it?

Code: [Select]
else
{
next = textures->next;
next = (Texture*)malloc(sizeof(Texture));
next->id = textures->id + 1;
next->next = ((void*)0);
textures = next;
tex = texture;//Its here.It should've been "textures" and not "texture"
}


Although , even with Genescript 0.1 there is a workaround to this.Since im not returning(yet) the address of the block
in memory, you can just fix the returned ids from the script.

« Last Edit: August 26, 2010, 12:03:22 AM by Conle »

Offline ChillyWilly

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1751
  • Just a coding machine.
Re: Genescript 0.2
« Reply #1 on: August 26, 2010, 12:11:14 AM »
Everything has bugs... I surprised you don't have more.  ~sm-72.gif~.gif  It's in pretty good shape, especially for a language. Those tend to be the buggiest of programs out.  ???

Offline Conle

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2203
Re: Genescript 0.2
« Reply #2 on: August 26, 2010, 12:29:05 AM »
There should be a few bugs in the compiler,but so far i haven't found anything that could
break the flow and trigger the runtime error routine.

The VM should have zero bugs.  8) In the runtime libs , there might be 1 or 2.. who knows  :)

I think , it was a wise idea to debug little blocks of code before
the final merge of all compilation stages(  ::sm-07.gif:: ) , because that's where i found & fixed most of the bugs in the generated code.  ~sm-41.gif~

Of course , this is not the first time that i attempt this  ~sm-68.gif~.gif  , but it was the first successful.   ~sm-65.gif~.gif