May 01, 2024, 05:41:59 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


some alpha 3.0 bugs

Started by sapero, April 30, 2006, 08:21:23 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sapero

April 30, 2006, 08:21:23 AM Last Edit: April 30, 2006, 08:28:42 AM by sapero

// bug 1 (or not yet supported)
extern int __some_fn1(); // ok

#typedef mytype int
extern mytype __some_fn2(); // error
import mytype __some_fn3(); // error


///////////////////////////////////////////////////////////
// bug 2: no warning, no description, just error in compiling
interface IBlah : IBlah {}
classÂÃ,  ÂÃ,  ÂÃ, CBlah : CBlah {}



///////////////////////////////////////////////////////////
// bug 3: passing string as int argument - the first byte is pushed
// instead string address
//
// additional bug for this example: CDialog::OnClose() is never called

#typedef LONG_PTR int
#typedef UINT_PTR unsigned int
#typedef WPARAM UINT_PTR
#typedef LPARAM LONG_PTR
#typedef LRESULT LONG_PTR
#typedef HWND unsigned int
#typedef UINT unsigned int
#define WM_SETTEXT 0xC


declare import,
SendDlgItemMessage alias SendDlgItemMessageA(
HWND hDlg, int nIDDlgItem, UINT Msg,
WPARAM wParam, LPARAM lParam),LRESULT;


class dlg:CDialog
{
declare OnInitDialog(),int;
declare OnClose(),int;
}

global sub main()
{
dlg d1;
d1.Create(0,0,300,202,0x80CA0880,0,"string bug",0);
d1.AddControl(CTBUTTON,", \"ok\");",83,12,141,39,0x50010000,0x0,1000);
d1.AddControl(CTBUTTON,", str);",83,57,141,39,0x50010000,0x0,1001);
d1.AddControl(CTBUTTON,", &&str);",83,102,141,39,0x50010000,0x0,1002);
d1.AddControl(CTBUTTON,", pstr);",83,147,141,39,0x50010000,0x0,1003);
d1.DoModal();
return;
}

dlg::OnClose(),int
{
MessageBox(null, "executing dlg::OnClose", "");
return true;
}

dlg::OnInitDialog(),int
{
SendDlgItemMessage(m_hwnd, 1000, WM_SETTEXT, 0, "ok"); // crash: push byte[STR00007]

stringÂÃ,  ÂÃ, str = "ok";
SendDlgItemMessage(m_hwnd, 1001, WM_SETTEXT, 0, str); // crash: push byte[[ebp-256]]
SendDlgItemMessage(m_hwnd, 1002, WM_SETTEXT, 0, &str);

string *pstr = "ok";
SendDlgItemMessage(m_hwnd, 1003, WM_SETTEXT, 0, pstr);
return true;
}


///////////////////////////////////////////////////////////
// bug 3a: byte / word / int arrarys are passed by value, instead by reference
extern int some_cdecl_func(...);
byte mydata[5];
some_cdecl_func(mydata);
// this bug is very nasty while using WCHAR strings (converting C++ samples)
WCHAR wsz[260<<1];
lstrcpyW(wsz, some_unicode_string); // ok, arguments are defined as pointers
SendDlgItemMessageW(m_hwnd, 1002, WM_SETTEXTW, 0, wsz); // error, lParam is defined as int
// fixup: replace in your thousand line program all 'wsz' to '&wsz'



///////////////////////////////////////////////////////////
// bug 4: commented #ifdef is not ignored, message = EOF
// fixup: add extra space after #
// sometimes commented #endif is not ignored too.

#ifdef ttttttt
/*
#ifdef r
*/
#endif


///////////////////////////////////////////////////////////
// bug 5: multiline comment is invalid ? (line 85 syntax error - /)

#ifdef rrrttt
/*
#endif
*/
#endif

/*
#endif
*/

///////////////////////////////////////////////////////////
// bug 6: navigation line error while double clicking
// in build window on undefined constant message
#define myconst otherconst // this is line 95, but parser shows 96


///////////////////////////////////////////////////////////
// bug 7: variable _5 is invalid (defined in directx matrix structures)

//d3dx9math.inc and other
struct D3DXMATRIX {
float m[0];//m[4][4];

float        _11, _12, _13, _14;
float        _21, _22, _23, _24;
float        _31, _32, _33, _34;
float        _41, _42, _43, _44;
}

Ionic Wind Support Team

Aurora is not C so your running into some of the differences.

Use & to get the address of a string if you insist on using API function. SendDlgItemMessage would not be needed for example.

Arrays are passed by reference but you need to declare the paremeter with [] so the compiler knows it is an array.

declare somefn(int myarray[] );





Ionic Wind Support Team

Parker

1) The extern mytype stuff isn't supported because things like INT and BYTE return the VARTYPE token instead of IDENT, so that the statement EXTERN something AS <type> can be supported.

2) I think it's expecting one or more items, when it should be 0 or more.

3) Technically you should have to cast here, since a STRING shouldn't be accepted as an INT, but you can't really do that :-\

4, 5) A real preprocessor (w/ macros) would be nice and fix any sort of these bugs

6) Either a yacc/lex error :o or real_line (line no. used for error reporting) isn't being set to yylineno (lex's internal line count) there.

7) I've already said that the regex for identifiers should be changed but no of course not... The current one looks like (from memory)
[_]*[A-Za-z]([A-Za-z0-9]|[_$@])*
the bold part is the problem, removing it and making the first part [A-Za-z_] will fix it.

Mike Stefanik

Also remember, this is still an Alpha release. As far as I know, Paul is keeping a list of all the problems reported, even if they aren't addressed right away. And he's incorporated a lot of our suggestions. A little patience goes a long way. ;)
Mike Stefanik
www.catalyst.com
Catalyst Development Corporation

Ionic Wind Support Team

Parker,
Quote
4, 5) A real preprocessor (w/ macros) would be nice and fix any sort of these bugs

Feel free to write another one.  Aurora does have a preprocessor of course, and macros have nothing to do with the error Sapero mentioned. #ifdef/#ifndef have a higher precedence in the lexer than comments do.   Which could be reversed.  Once I look for any side effects.

Quote
7) I've already said that the regex for identifiers should be changed...

Nope, not what he was complaining about.  The parser currently doesn't allow a number after a beginning underscore (_5) to be an identifier, which can be changed of course.

Quote
Paul is keeping a list of all the problems reported, even if they aren't addressed right away. And he's incorporated a lot of our suggestions. A little patience goes a long way

Some people don't have a lot of patience ;).  And yes I do note everything, my list is very large so I stick with one area at a time as not to introduce subtle bugs.  If you change too much at once you end up with a mess ;)

I realize with the happenings over at the other site that there are those that wish Aurora was further along at the moment. But you also have to understand that it currently is only a part time endevour for me.  A few hours a day is all I can afford to devote to the project.  Have to feed the family first ;)

Paul.
Ionic Wind Support Team

Mike Stefanik

Even in its alpha stages I think Aurora is significantly ahead of the game when compared to the release version of IBasic. And of course Aurora is actually being worked on, which always helps.  ;)
Mike Stefanik
www.catalyst.com
Catalyst Development Corporation

Ionic Wind Support Team

Yes it is a lot further ahead in some areas.  Still a little rough in others, but that is changing with each revision.
Ionic Wind Support Team

Bruce Peaslee

Quote from: Mike Stefanik on April 30, 2006, 10:48:44 PM
Even in its alpha stages I think Aurora is significantly ahead of the game when compared to the release version of IBasic. And of course Aurora is actually being worked on, which always helps.ÂÃ,  ;)

I agree. My HoodMap application was quite useful until my hard disk crash wiped out the dataÂÃ,  :P . (I downloaded the program back from the project area, but it had fake data.)
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Ionic Wind Support Team

Fixed a few of these for A3 Rev 1. 

You can define a variable consisting of just an underscore and a number, like used in DX matrices.
Ionic Wind Support Team

sapero

May 02, 2006, 03:11:59 AM #9 Last Edit: May 02, 2006, 03:23:32 AM by sapero
Thanks. I've found one mistake while assigning undefined return type from function to integer.
As default functions are returning UDT if the type is not defined.
The error message is : no appropriate conversion from STRUCT to INT exists
sub x(),undefinedtype
{return 9;}

global sub main(),int
{return x();}

Cound be the default type changed to integer, or added a warning?

and this one (only removed \n) says RETURN outside of subroutine
sub x(),int {return 9;}

I found this all while converting c headers (40% done, 10MB of .inc files)
#include "windows.inc" works now like in c programs ;D
Also I had to replace / comment/ delete / compile, and here the bugs are fast to find.
The one with commented #if was the biggest problem for me.

do we need #undef ?

Ionic Wind Support Team

As for the first one it is assuming it is a structure since an ident that is not an intrinsic or typedef'd type is being used.

sub x(),blah

Gets marked as returning a struct since 'blah' is unknown during the first pass. 
Ionic Wind Support Team

Parker

I think the second may have to do with the 1st parsing stage also, because a new line is only handled as whitespace in the second pass. But I'm not sure exactly why you can't do that without a new line :-/

Ionic Wind Support Team

No the second error is in the second pass.  Seems to be a precedence problem with the parser generator.  It is executing the closing brace context before the return statement.  Not a big deal though.  Fixing it might cause more problems then leaving it though, so I'll have to experiment ;)



Ionic Wind Support Team

Ionic Wind Support Team

OK fixed for A3 rev 1.   One of those "duh" moments, bit it was a simple fix ;)
Ionic Wind Support Team

sapero

May 04, 2006, 12:46:09 PM #14 Last Edit: May 04, 2006, 12:51:28 PM by sapero
The BYVAL keyword (for variant) in webband example works great!

But Microsoft has defined some nonacceptable constants in directx includes, in file sdklayers.h (latest dxsdk)
#define D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERBYTECODE 0
#define D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDS 1

(the values are custom)

the message is - duplicate constants, different values.
This must be a 62 characters limitation.
Sorry, I found this only ;D

The longest constant name ive seen is (lol!) D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTARTCOMPONENTANDCOMPONENTCOUNT

Mike Stefanik

Ok, that's just taking self-documenting code to ridiculous extremes. :)
Mike Stefanik
www.catalyst.com
Catalyst Development Corporation

Ionic Wind Support Team

And considering DX10 *requires* Vista, which won't be out until next year, it gives us plenty of time to adapt.  Not that anyone has any DX10 capable video cards yet.
Ionic Wind Support Team

Ionic Wind Support Team

Nice job on the include files BTW ;)
Ionic Wind Support Team

Mike Stefanik

Nice work on the includes! Just so you know, you have an old SocketTools header file in there somehow (SocketTools.inc) that should be removed. :)
Mike Stefanik
www.catalyst.com
Catalyst Development Corporation

sapero

Sorry, I missed the SocketTools.inc file. I had to remove all the standard and all includes from community.
Uploaded new

Have found an unknown and nasty bug in D3DCAPS9 structure - while converting Creating 2D Sprites with D3DXSprite sample.
Size of this structure is different in Aurora and VC++6.
Found missing members: RasterCaps and LineCaps, maybe more is missing. Both are defined inside this structure, but they are invisible for compiler!
the sample is included in tipps\DirectX\Direct3D\Creating 2D Sprites with D3DXSprite.

also, this works great:#typedef D3DDEVTYPE int // avoid other includes
#typedef UINT DWORD
#include "d3d9caps.inc"

global sub main(),int
{
D3DCAPS9 c;
print(&c.RasterCaps - &c);
print(&c.LineCaps - &c);
return;
}

but this says that RasterCaps and LineCaps are undefined.#include "d3dx9.inc"

global sub main(),int
{
D3DCAPS9 c;
print(&c.RasterCaps - &c);
print(&c.LineCaps - &c);
return;
}

The D3DCAPS9 structure is defined only in d3d9caps.inc.

Another problem (not a bug) - directx 8. Where can I find d3dx8.dll? I have only the debug version, and some samples while executing api D3DXAssembleShaderFromFile are crashing.
See in D3D Tutorial 15 - Cube mapping [crash]

Yet another problem: if function qq returns a structure, function ww returns directly the result from qq() - compiler says no appropriate conversion from struct to struct.sub __getrect(),RECT
{
RECT rc;
return rc;
}

sub __getrect2(),RECT
{
return __getrect();
}

Ionic Wind Support Team

There are different versions of the DirectX 9 headers depending on what SDK release you have.  The one I work with is October 2004 since it is the last version to have support fo older OS's.

There are no release versions of d3dx8 or d3dx9.DLL's.  The debug versions are not redistributable.  The d3dX library exisits as a static library for VC 6.0 and up, and that library is not compatible with any other compiler.

Quote
Size of this structure is different in Aurora and VC++6.

Missing members?  Packing different?  Look for pragmas in the include file, a "pragma pack" changes the default packing.
Ionic Wind Support Team

Parker

Have you tried c.&RasterCaps? The & and * operators expect an identifier, not an expression as in C. For example, x.*y
If that doesn't work though, it'll need to be implemented.

Ionic Wind Support Team

The * works with expressions.

a = *(int)(u + 100);
Ionic Wind Support Team

sapero

No Parker, i don't need any pointers, both missed are a dword (d3d9caps.inc). I've used the & operator (in aurora and vc) to fast find where is the size leak.
After running the example first time - the function init never returned, stack dump was empty, and EIP was null.
Found changed return address from init() to null. Added some print([ebp+4]) and found that IDirect3d::GetDeviceCaps causes this error. Ok, if the structure D3DCAPS9 is too small, the return address and saved registers are overwriten:
// include all: d3dx9
sub init()
{
    g_pD3D = Direct3DCreate9( D3D_SDK_VERSION );

    D3DCAPS9 d3dCaps; // defined ok, but some members are missing
    g_pD3D->GetDeviceCaps( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dCaps );
    // from here "return" jumps to null


Note: the GetDeviceCaps method is idle here, nothing from returned data is used.
If you include only d3dcaps - the D3DCAPS9 structure is valid, but including all dx9 files something goes wrong in the parser - missing 8 bytes.

A copy of this structure with different name didn't help, same members are missing.
While parsing this example - a huge collection of declares, structures and constants is stored in memory, acparse uses 164MB pp.

Ionic Wind Support Team

Delcares, structures and constants are stored in linked lists so are only limited by available memory.  Post the d3dcaps9 structure here so I can glance at it, maybe I'll spot something your missing.

Is it possible you have the structure defined twice?

Ionic Wind Support Team