I have some code that uses OS_GPBP 12 to iterate
over objects in a directory, returning for each one
its name and filetype. It has been working for years
in RiscLua, when compiled with Norcroft and Objasm.
Now that I am using GCC the filetype is always
returned as zero, and I cannot see why.
OS_GPBP 12 uses a buffer to return its results,
with the object's name as a zero-terminated
string at buf+24, and the filetype in the word
at buf+20. I declare a buffer with
static const int rdir_buf[RDIR_BUFLEN/sizeof(int)];
After the call to OS_GPBP 12 my code grabs the
name and filetype with
lua_pushstring(L, (char *)(&rdir_buf[6])); /* name */
lua_pushinteger(L, rdir_buf[5]); /* file type */
return 2; /* number of returned values */
This stuff is what makes the construction
for name, ftype in dir (foo) do .... end
work - well it used to The 'name' part comes out OK, but the
'ftype' is always zero, and I just cannot see why.
--
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/
_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK
No comments:
Post a Comment