Re: glutinit() and main() in C
Hello again,
>How to translate to Euphoria.
>sequence cmd
>integer len
>
>cmd =3D command_line()
>cmd =3D {cmd[1]} & cmd[2..length(cmd)] -- Get rid of second element.
>len =3D length(cmd)
>Allocate an array of addresses len long.
>Allocate an array for each element in cmd and poke it into memmory, put=
it's
>addresses into the array created earlier.
>Allocate an C_INT put len in it.
>Pass it's address and the arrays address to glutinit()
Here's what I came up with:
=A6atom array_ad, array_len
=A6sequence free_stuff
=A6free_stuff =3D {}
=A6-------------------------------------------------------------------------=
---
=A6procedure handle_command_line()
=A6atom string
=A6integer len
=A6sequence cmd
=A6cmd =3D command_line()
=A6cmd =3D cmd[2..length(cmd)] -- actually wants the name of the program
=A6len =3D length(cmd)
=A6array_ad =3D allocate (len*4)
=A6free_stuff=3D append(free_stuff,array_ad) -- so I free it later
=A6for i =3D 1 to len do
=A6 string =3D allocate_string(cmd[i] & 0) -- add 0 to denote end of=
string
=A6 free_stuff =3D append(free_stuff,string)
=A6 poke (string,cmd[i] & 0)
=A6 poke (array_ad+((len-1)*4), int_to_bytes(string))
=A6end for
=A6array_len =3D allocate(4)
=A6free_stuff =3D append(free_stuff,array_len)
=A6poke (array_len, int_to_bytes(len))
=A6end procedure
=A6-------------------------------------------------------------------------=
---
=A6handle_command_line()
=A6-------------------------------------------------------------------------=
---
Well, heh it still does not appear to work. Although GLUT did try to open a
window
but soon bombed after that. Did I miss something? Or is the problem else
where?
Thank you guys for all of your help so far. =20
|
Not Categorized, Please Help
|
|