[Vm-dev] FilePlugin argument checking - primitiveFailed vs PrimErrBadArgument

tim Rowledge tim at rowledge.org
Thu Mar 1 22:20:23 UTC 2018



> On 01-03-2018, at 11:21 AM, Alistair Grant <akgrant0710 at gmail.com> wrote:
> 
> 
> Hi Everyone,
> 
> I'm currently extending FilePlugin to allow files to be opened using
> either a file descriptor or FILE*.  

If you have some time, and the interest, to do stuff for FilePlugin then please, please, consider doing a real rewrite. For some time (as in "since 1997") we've needed better file connections. The original file primitives (way befor eplugins were even imagined) were written to make use of the most basic posix library. Thus we get the utter insanity of the 'set file pointer' and 'write to file pinter' separation.

It would be nice if the prims that need a file name would only accept instances of a class specifically for filenames, so we can separate out deriving the file path from plain String stuff. It would be nice to have a prim that asks the OS to canonicalise the name - ie take 'fred.jpg' and work out the full, exact, name for us. RISC OS has a nice call to do exactly this [1] and it's hard to imagine other OSs can't do the same; after all they have to do it at *some* point anyway. I guess the prim could fail if needed and defer to image code that tries to do The Right Thing.

Merging in your file attributes would be nice. Dave Lewis did some directory related plugin stuff a while back. Being able to read & set modes and permissions and metadata would help. That ancient and horrible FileCopyPlugin I wrote? Needed only because you couldn't read nor write such stuff and it was essential to copying vmmaker related scripts etc.

We ought to do so much better. There have been plenty of discussions over the years but no real change. Maybe you can effect some?


tim
[1] RISC OS has a lot of nice stuff that other OSs should damn well have copied decades ago. One nice example - back in the last millennium Eliot was able to use ffi calls to actually implement a way to read DOS formatted discs on an Acorn Archimedes, purely within image code.
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
"Daddy, what does FORMATTING DRIVE C mean?"




More information about the Vm-dev mailing list