Forums

Problems with Tao-Framework and Cobra

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Problems with Tao-Framework and Cobra

Postby johannes » Thu Mar 13, 2008 3:48 pm

I'm trying to build some short Tao.SDL example but I have quite some problems compiling it..
while trying to compile this:
use Tao.Sdl

class Program

def main is shared
Sdl.sdl_Init(Sdl.sdl_INIT_EVERYTHING)
surfacePtr = Sdl.sdl_SetVideoMode(640,480,32,(Sdl.sdl_HWSURFACE|Sdl.sdl_DOUBLEBUF|Sdl.sdl_ANYFORMAT))


I got this error ( sdl_INIT_EVERYTHING etc. really exist in Tao.Sdl in other programming languages..) :

Code: Select all
X:\cobra>cobra.exe -sharp-compiler:"H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc" muh.cobra -r:Tao.Sdl -lib:X:\Programme\Tao\examples
muh.cobra(11): warning: Unnecessary parentheses around expression. You can remove them.
muh.cobra(10): error: Cannot find a definition for "sdl_INIT_EVERYTHING" in "Sdl" whose type is "Sdl". There is a member named "Sdl" with a similar name.
muh.cobra(10): error: Cannot find a definition for "sdl_Init" in "Sdl" whose type is "Sdl". There is a member named "Sdl" with a similar name.
[...]
muh.cobra(11): error: Cannot find a definition for "sdl_SetVideoMode" in "Sdl" whose type is "Sdl". There is a member named "Sdl"
with a similar name.
muh.cobra(11): warning: The value of variable "surfacePtr" is never used.
Compilation failed - 6 errors, 2 warnings
Not running due to errors above.



so I changed the Program like this :
use Tao.Sdl

class Program

def main is shared
Sdl.Sdl.sdl_Init(Sdl.Sdl.sdl_INIT_EVERYTHING)
surfacePtr = Sdl.Sdl.sdl_SetVideoMode(640,480,32,(Sdl.Sdl.sdl_HWSURFACE|Sdl.Sdl.sdl_DOUBLEBUF|Sdl.Sdl.sdl_ANYFORMAT))


but of course I got an error since everything is defined in Tao.Sdl and not Tao.Sdl.Sdl ...
Code: Select all
X:\cobra>cobra.exe -sharp-compiler:"H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc" muh.cobra -r:Tao.Sdl -lib:X:\Programme\Tao\examples
muh.cobra(9): warning: Unnecessary parentheses around expression. You can remove them.
muh.cobra(9): warning: The value of variable "surfacePtr" is never used.
muh.cobra(8): error: Tao.Sdl.Sdl enthält keine Definition für Sdl.
muh.cobra(9): error: Tao.Sdl.Sdl enthält keine Definition für Sdl.
Compilation failed - 2 errors, 2 warnings
Not running due to errors above.



What am I doing wrong here ? or is this really a bug ?
johannes
 
Posts: 8

Re: Problems with Tao-Framework and Cobra

Postby Charles » Thu Mar 13, 2008 8:36 pm

Looks like a bug. I will investigate.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Problems with Tao-Framework and Cobra

Postby Charles » Fri Mar 14, 2008 12:15 am

This was a silly bug in symbol lookup. Only happened when a type was contained in a namespace with the same name. I have squashed it and locked it out with a new test case.

Past that I found a couple other bugs and squashed those. I have Tao.Sdl installed on my system now and have added a compilation test case against it.

If you have further problems using Tao, let me know.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Problems with Tao-Framework and Cobra

Postby johannes » Fri Mar 14, 2008 11:07 am

thanks works without problems now ;) If I write something useful with it I will post it here ;)
johannes
 
Posts: 8

Re: Problems with Tao-Framework and Cobra

Postby Charles » Fri Mar 14, 2008 1:44 pm

Well even if it's not useful, but it shows several of the API calls, that is useful. Take a look at the WinForms and Access MySQL How To's to see what I mean.

We need just enough to get somebody started with compilation options, critical tips and some basic code.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Problems with Tao-Framework and Cobra

Postby johannes » Fri Mar 14, 2008 4:32 pm

I have some other Problem now...
evt as Sdl.SDL_Event
is translated to
Code: Select all
SDL_Event evt;
in the .cs Code (and of course does not compile) is this supposed to be like that ?
johannes
 
Posts: 8

Re: Problems with Tao-Framework and Cobra

Postby Charles » Fri Mar 14, 2008 5:25 pm

No, that's a bug. I'll take a look.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Problems with Tao-Framework and Cobra

Postby Charles » Fri Mar 14, 2008 8:01 pm

The Cobra compiler was not noting the containing class/interface/struct of a nested type when reading DLLs.

Fixed in development.

I dare you to find another bug. :mrgreen:
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Problems with Tao-Framework and Cobra

Postby johannes » Sat Mar 15, 2008 3:53 pm

Actually I think I might have found two other bugs it seems ;)

Cobra can not find "type" in SDL_Event (but SDL_Event has an element named type)
Code: Select all
muh.cobra(21): error: Cannot find a definition for "type" in "evt" whose type is "SDL_Event". There is a member named "getType" with a similar name.


The second unexpected error I got was this one
Code: Select all
error: COBRA INTERNAL ERROR / AssertException / ; sourceSite = X:\cobrasvn\Source\CobraParser.cobra:1755 in Parser.branchStmt for
object Parser; info       = nil; this       = Parser;     not (expr inherits BinaryOpExpr) = false;         (expr inherits BinaryO
pExpr) = true;         expr = DotExpr-sh(10341, didBindInh=false, didBindInt=false, didBindImp=false, token=Token(DOT, '.', '.', l
n 25, col 11, muh.cobra), type=nil, definition=nil, 10341);         BinaryOpExpr = BinaryOpExpr (RuntimeType);


while compiling this piece of code:
branch  aaa
on Sdl.SDL_QUIT
break


it seems it does not like the Sdl.SDL_QUIT since it works if I write the numeric value of SDL_QUIT directly
johannes
 
Posts: 8

Re: Problems with Tao-Framework and Cobra

Postby Charles » Sat Mar 15, 2008 4:01 pm

I look forward to fixing these. But the machine hosting this site just went down which was kind of scary. It came back up okay, but I need to get automated backups going instead of relying on sporadic, manual backups. So I'm going to work on that now.

In the meantime, Can you attach a whole program for each problem including compilation line in a comment or doc string? It would make my life a little easier.

(I wonder how many people don't notice that topics are broken into pages 1 2 3 etc. Look to the right.)
Charles
 
Posts: 2515
Location: Los Angeles, CA

Next

Return to Discussion

Who is online

Users browsing this forum: No registered users and 27 guests