On 9/23/07, skaller <[EMAIL PROTECTED]> wrote: > This is a good question. Detecting the right sizes in config isn't a > nice option.
I didn't like it either :) > One solution is, for each platform, define the relevant types as > abstract: > > ctypes dev_t, ino_t, mode_t ...; > > Then you can make a cstruct, and you are left with the problem > of 'unabstracting' some of the types. For example: > > ctor ulong : u_long = "(unsigned long)$1"; > ctor int : uid_t = "(int)$1"; > ctor ulong : off_t = "(unsigned long)$1"; > > and now you can access these types with a cast. Choosing a suitable > type for the cast remains a problem. However, the functions should > be the same for all stat records, even Windows .. so you'd probably > want an abstraction layer: > > fun filesize: stat_t -> ulong = > | ?st => ulong st.st_size > ; > > This should work on all platforms. Gotcha. I was thinking along those lines. What I'm thinking is that we have a three layer system for doing os interactions. First, is a low-level lightweight wrapper of the native c/c++ apis. Second, we have a high level portable wrapper of the low level stuff. Finally, we have high level convenience apis written using the portable middle layer. I'll write more tomorrow since it's late. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language