At 09:39 PM 2/5/2002 -0500, Josh Wilmes wrote: >Some day we're going to want a miniparrot which can build almost anywhere. >Just out of curiousity, I was wondering how we're doing as far as being >portable. >Of these, 16 are not defined by ANSI C89: > close
To comform to ANSI we would probably have to use fclose() which means STDIO, but we don't want STDIO so close() is about as portable as it gets for at least the UNIX contingent (and a lot of others probably). > lseek64 > mmap64 > open64 > creat64 > fopen64 > stat64 I think these are being linked in or defined by a macro on your system, we are not explicitly using any *64 named version. > isatty Not really any portable way to mimic this (fcntl/ioctl), not much of a worry. I have put a Win32 version of this already, so we have Win32 + UNIX(ish). For miniparrot I guess you could get by without it, just making assumptions about the file handle. >Really not too bad. Most of those are from unistd.h. I agree, these aren't much to worry about. >If we can organize the source tree so that platform-dependent stuff is all >in one place (which is mostly is, but probably not all) I can exclude that >from this list, and we can write dummy versions of those functions for >miniparrot. For IO I already have a platform specific file for each target. I guess the goal of Miniparrot is to compile anywhere, and I really feel that to be _very_ portable when it comes to the IO/System stuff you have to use STDIO (fopen, fprintf, fwrite) which is ANSI, but personally I wish we would not go there, however.....what we've got now is a "layered" IO setup so I we could easily go ahead and add in a "miniparrot" layer that locally includes stdio in the single file and wraps the core stuff (fopen/fclose/fread/fwrite/fsetpos) in a very slim footprint. Currently it is like: Layer1: PIO Layer2: PIO_stdio Layer3: {PIO_unix | PIO_win32 | ...} The entry points are in Layer 1, the buffering is Layer 2, and then some terminal layer which is OS specific. No platform specific code goes into the top 2 layers. So all we would do for miniparrot for IO and IPC stuff would be: #ifdef MINIPARROT PIO_push_layer(interpreter, PIO_base_new_layer(&pio_miniparrot_layer), NULL); #else /* Full blown Parrot */ #endif I would rather just wait and see how far we can go without STDIO and only fall back on it as last resort. -Melvin