// 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;
}
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[] );
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.
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. ;)
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.
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. ;)
Yes it is a lot further ahead in some areas. Still a little rough in others, but that is changing with each revision.
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.)
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.
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 ?
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.
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 :-/
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 ;)
OK fixed for A3 rev 1. One of those "duh" moments, bit it was a simple fix ;)
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
Ok, that's just taking self-documenting code to ridiculous extremes. :)
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.
Nice job on the include files BTW ;)
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. :)
Sorry, I missed the SocketTools.inc file. I had to remove all the standard and all includes from community.
Uploaded new (http://www.webfilehost.com/?mode=viewupload&id=2137074)
Have found an unknown and nasty bug in D3DCAPS9 structure - while converting Creating 2D Sprites with D3DXSprite (http://www.codesampler.com/dx9src/dx9src_8.htm) 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();
}
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.
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.
The * works with expressions.
a = *(int)(u + 100);
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.
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?
no, it is defined only once. All includes are created by "find/replace all in files" + manual correction.
//#typedef D3DDEVTYPE int // enumeration from d3d9types
struct D3DVSHADERCAPS2_0
{
DWORD Caps;
INT DynamicFlowControlDepth;
INT NumTemps;
INT StaticFlowControlDepth;
}
struct D3DPSHADERCAPS2_0
{
DWORD Caps;
INT DynamicFlowControlDepth;
INT NumTemps;
INT StaticFlowControlDepth;
INT NumInstructionSlots;
}
struct D3DCAPS9
{
// Device Info
D3DDEVTYPE DeviceType;
UINT AdapterOrdinal;
// Caps from DX7 Draw
DWORD Caps;
DWORD Caps2;
DWORD Caps3;
DWORD PresentationIntervals;
// Cursor Caps
DWORD CursorCaps;
// 3D Device Caps
DWORD DevCaps;
DWORD PrimitiveMiscCaps;
DWORD RasterCaps;
DWORD ZCmpCaps;
DWORD SrcBlendCaps;
DWORD DestBlendCaps;
DWORD AlphaCmpCaps;
DWORD ShadeCaps;
DWORD TextureCaps;
DWORD TextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DTexture9's
DWORD CubeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DCubeTexture9's
DWORD VolumeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DVolumeTexture9's
DWORD TextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DTexture9's
DWORD VolumeTextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DVolumeTexture9's
DWORD LineCaps; // D3DLINECAPS
DWORD MaxTextureWidth, MaxTextureHeight;
DWORD MaxVolumeExtent;
DWORD MaxTextureRepeat;
DWORD MaxTextureAspectRatio;
DWORD MaxAnisotropy;
float MaxVertexW;
float GuardBandLeft;
float GuardBandTop;
float GuardBandRight;
float GuardBandBottom;
float ExtentsAdjust;
DWORD StencilCaps;
DWORD FVFCaps;
DWORD TextureOpCaps;
DWORD MaxTextureBlendStages;
DWORD MaxSimultaneousTextures;
DWORD VertexProcessingCaps;
DWORD MaxActiveLights;
DWORD MaxUserClipPlanes;
DWORD MaxVertexBlendMatrices;
DWORD MaxVertexBlendMatrixIndex;
float MaxPointSize;
DWORD MaxPrimitiveCount; // max number of primitives per DrawPrimitive call
DWORD MaxVertexIndex;
DWORD MaxStreams;
DWORD MaxStreamStride; // max stride for SetStreamSource
DWORD VertexShaderVersion;
DWORD MaxVertexShaderConst; // number of vertex shader constant registers
DWORD PixelShaderVersion;
float PixelShader1xMaxValue; // max value storable registers of ps.1.x shaders
// Here are the DX9 specific ones
DWORD DevCaps2;
float MaxNpatchTessellationLevel;
DWORD Reserved5;
UINT MasterAdapterOrdinal; // ordinal of master adaptor for adapter group
UINT AdapterOrdinalInGroup; // ordinal inside the adapter group
UINT NumberOfAdaptersInGroup; // number of adapters this adapter group (only if master)
DWORD DeclTypes; // Data types, supported vertex declarations
DWORD NumSimultaneousRTs; // Will be at least 1
DWORD StretchRectFilterCaps; // Filter caps supported by StretchRect
D3DVSHADERCAPS2_0 VS20Caps;
D3DPSHADERCAPS2_0 PS20Caps;
DWORD VertexTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DTexture9's for texture, used vertex shaders
DWORD MaxVShaderInstructionsExecuted; // maximum number of vertex shader instructions that can be executed
DWORD MaxPShaderInstructionsExecuted; // maximum number of pixel shader instructions that can be executed
DWORD MaxVertexShader30InstructionSlots;
DWORD MaxPixelShader30InstructionSlots;
}
I assume you have UINT and DWORD defined somewhere?
I believe those are defined in a default header (something included from the 2d headers)
DWORD is (ddraw.inc, the default one) but UINT isn't.
don't worry, UINT and other are defined somewhere in winbase or wintypes, and some posts above ;D
Undefined types in UDT are always(first?) reported while compiling.
I'll poke around the compiler source. Perhaps I can spot something overwriting memory on large include files.
I have found a new bug: typecasted pointer array always has size of one pointer:
GUID *pg
- ;
always - on stack and in .bss section (resd 1)
That's correct. A pointer is always 4 bytes, no matter what it points to.
brackets are gone ???
I mean: size of this array = 4 bytes (one pointer)
GUID *pg[5];
Changing second pointer - the next variable (if any) is overwritten.
Same problem with class pointer array:
Cwindow *ppp[10] allocates only one pointer
segment .bss use32 align=4
$ppp resd 1
Noted. That syntax is not yet supported. Use the POINTER type and typecasting for now.
pointer pg[5];
Fixed for Rev 6