On 12 April 2010 05:50, Mike Caron <[email protected]> wrote: > Ralph Versteegen wrote: >> >> On 11 April 2010 06:44, Mike Caron <[email protected]> wrote: >>> >>> Ralph Versteegen wrote: >>>> >>>> On 10 April 2010 14:36, <[email protected]> wrote: >>>>> >>>>> pkmnfrk >>>>> 2010-04-09 19:36:28 -0700 (Fri, 09 Apr 2010) >>>>> 710 >>>>> Several untested major rewrites in RELOAD >>>>> >>>>> (Isn't that a catchy header?) >>>>> >>>>> I joke, they were all tested: >>>>> >>>>> 1. Instead of using the FB file I/O functions, I switched to the CRT >>>>> I/O >>>>> functions, as they let me load directly into memory buffers >>>> >>>> FB's file functions let you load into buffers, and we do it all over >>>> the place. But the syntax is UGLY. So ugly in fact that Simon started >>>> and I continued redeclaring the rtlib functions implementing GET and >>>> PUT and calling them directly without having to remember the BASIC >>>> syntatical nonsense: >>>> >>>> declare function fget alias "fb_FileGet" ( byval fnum as integer, >>>> byval pos as integer = 0, byval dst as any ptr, byval bytes as >>>> uinteger ) as integer >>>> declare function fput alias "fb_FilePut" ( byval fnum as integer, >>>> byval pos as integer = 0, byval src as any ptr, byval bytes as >>>> uinteger ) as integer >>>> >>>> I would prefer that we stuck to FB's file functions, so that there'll >>>> be less work in switching over to the Lumpfile abstracted file IO, but >>>> it shouldn't be too much work to replace all your uses of C file IO >>>> when I get around to it. >>> >>> I am aware of those, but they weren't working for me. They weren't >>> loading >>> any data from the file. >> >> You weren't checking the return value, were you? The return value is >> not the number of bytes read/written. > > What? Who checks return values? ;) > > No, seriously, I wasn't. Basically, I was doing this: > > dim zs as zstring ptr = RAllocate(size + 1, doc) > get #f, , *zs, size > > And, it wasn't reading anything, which was causing problems, as you could > imagine.
Ugh, don't make me think about this. My guess is that it thought that you wanted to read size * sizeof(zstring) bytes, and zstring might be length 0. >>> When we do use this abstracted IO, I'll deal with making RELOAD >>> compatible, >>> don't worry. >> >> Thanks, but is there any reason you want to do that: would you want to >> do anything other than a straight translation? > > I dunno. Does this interface exist yet? Yes, in lumpfilewrapper.bi, though it's not complete. But I think it works, since the last thing I was about to do was to test whether playing lumped music files would work, using this C-I/O-style wrapper. >>>>> 2. Instead of using the FB String type, I switched to manually managed >>>>> ZStrings for the all-important string table. >>>>> 3. Instead of using the FB default memory management functions, I >>>>> created >>>>> some new ones to wrap the private heap feature. Remember: this still >>>>> only >>>>> works on Windows. Other platforms, or if it's disabled at compile time, >>>>> use >>>>> the default heap. >>>>> >>>>> This should A) Fix bug 831, and B) make everything tons easier to deal >>>>> with in the future, RE adding new things. >>>>> --- >>>>> U wip/reload.bas >>>>> U wip/reload.bi >>>>> U wip/reloadtest.bas >>>> >>>> _______________________________________________ >>>> Ohrrpgce mailing list >>>> [email protected] >>>> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org >>> >>> -- >>> Mike >>> _______________________________________________ >>> Ohrrpgce mailing list >>> [email protected] >>> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org >>> >> _______________________________________________ >> Ohrrpgce mailing list >> [email protected] >> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org > > -- > Mike > _______________________________________________ > Ohrrpgce mailing list > [email protected] > http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org > _______________________________________________ Ohrrpgce mailing list [email protected] http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
