[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gm2] Re: Re: Re: error with ARRAY OF CHAR
From: |
Martin Kalbfuß |
Subject: |
[Gm2] Re: Re: Re: error with ARRAY OF CHAR |
Date: |
Tue, 01 Dec 2009 19:17:45 +0100 |
Hi,
I got the newest CVS and tried it again. Same error. I don't think it
has something to do with the exceptions. Its related to the content of
(file : ARRAY OF CHAR) parameter in some way.
I tried to debug my program. with gdb. Everything looks fine. The only
thing I recognized is the the changing value of file while entering the
function LoadBMP. The stored address jumps from
0x806a810 to 0xbfff2c0 on BEGIN of LoadBMP. I have no idea if this is
correct or of any interest. But everything else looks fine.
This is the declaration of the problematic function inside the SLD
header file.
extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFile(const char *file,
const char *mode);
The GM2 equivalent in the C Module file:
PROCEDURE SDL_RWFromFile(file, mode : ARRAY OF CHAR) : RWOpS;
The calling function:
PROCEDURE LoadBMP(file : ARRAY OF CHAR) : VideoBase.SurfacePtr;
VAR
src : VideoBase.RWOpS;
BMP : VideoBase.SurfacePtr;
BEGIN
(* Here's the problematic call *)
src := VideoBase.SDL_RWFromFile(file, 'rb');
IF src = NIL THEN
SKGeneral.Raise();
END;
BMP := VideoBase.SDL_LoadBMP_RW(src , 1);
IF BMP = NIL THEN
SKGeneral.Raise();
END;
RETURN BMP;
END LoadBMP;
The call to VideoBase.SDL_RWFromFile is returning NIL. So
SKGeneral.Raise() is called.
The bitmap is there and named correctly.
If I pass 'test.bmp' instead of file I get a working program. The
functinon is returning a file instance(RWOpS) which is not NIL,
representing the bitmap file.
src := VideoBase.SDL_RWFromFile('test.bmp', 'rb');
Thanks for help,
Martin Kalbfuß
Am Freitag, den 27.11.2009, 15:57 +0000 schrieb Gaius Mulley:
> Martin Kalbfuß <address@hidden> writes:
>
> > Hi,
> >
> > Thanks for your fast help.
> >
> > I tried it with the latest CVS. Now I get
> >
> > ../../gcc/gm2/gm2-libs-iso/EXCEPTIONS.mod:60:3:Couldn't open p.� in
> > RAISE
> >
> > As you can see the filename is still garbage. But it runs thru
> > VideoBase.SDL_RWFromFile. The Exception is raised afterwards, because
> > the return value of the function is nil. Still works when passing
> > 'test.bmp' directly.
> >
> > Thanks,
> >
>
> Hi Martin,
>
> I've made some changes to RTExceptions.mod, I wonder if you could try
> using the latest cvs tarball and remake all objects and see if the
> problem still remains. I've successfully single stepped the following
> test code:
>
> MODULE raise ;
>
> FROM EXCEPTIONS IMPORT RAISE, ExceptionSource, AllocateSource ;
> FROM libc IMPORT printf ;
>
> VAR
> e: ExceptionSource ;
> BEGIN
> printf('entering main module\n') ;
> AllocateSource(e) ;
> RAISE(e, 1, 'tiny test') ;
> HALT(1)
> EXCEPT
> printf('caught nicely\n') ;
> HALT(0)
> END raise.
>
>
> and
>
> MODULE raise2 ;
>
> FROM EXCEPTIONS IMPORT RAISE, ExceptionSource, AllocateSource ;
> FROM libc IMPORT printf ;
>
> PROCEDURE test (a: ARRAY OF CHAR) ;
> BEGIN
> RAISE(e, 1, a) ;
> HALT(1)
> EXCEPT
> printf('caught nicely\n') ;
> HALT(0)
> END test ;
>
> VAR
> e: ExceptionSource ;
> BEGIN
> printf('entering main module\n') ;
> AllocateSource(e) ;
> test("tiny test")
> END raise2.
>
>
> the contents of the ARRAY OF CHAR looked fine. Is this an accurate
> model of your code?
>
> regards,
> Gaius
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gm2] Re: Re: Re: error with ARRAY OF CHAR,
Martin Kalbfuß <=