OSLib 6.11 Released

Ainsley Pereira marble at executor.karoo.co.uk
Tue Sep 26 20:55:28 BST 2000


In message <200009252108.OAA18199 at purple.trimedia.sv.sc.philips.com>
          "Jonathan Coxhead" <jonathan at doves.demon.co.uk> wrote:

>  | Well, I find it useful. Nasty #defines time? I think you can do something
>  | like:
>  | 
>  | #define INC_PREFIX "OSLib:"  (or "" at your preference)
>  | 
>  | then
>  | 
>  | #include INC_PREFIX ## "header.h"
>  | 
>  | but I haven't actually tried it. (Or just make everyone on other 
> platforms
>  | sed them ;) )
> 
>    That doesn't work---it's explicitly pointed out in the C Standard that 
> you can't do that.

Fair point. From the examples in section 6.8.3.5 though, this is allowed, and I have tried it:
#define GLUE(s) #s
#define OSLIB(header) GLUE(OSLib:header)

// eg.
#include OSLIB(types.h)


>    As far as I can see, the best way to decrease the chance of collision 
> with other headers is to use the already-existing division of OSLib into 4 
> functional units: Core, Computer, User, Toolbox. Norcroft C already maps 
> "/" in include directives onto "." (as well as converted "X.h" into "h.X"), 
> so the following should work a charm:
> 
>       #include "Core/os.h"
>       #include "Computer/osfind.h"
>       #include "User/wimp.h"
>       #include "Toolbox/keyboardshortcut.h"

Core, Computer, User and to a lesser extent Toolbox aren't exactly the most unique names though. I have at least one project with a 'Core' module. (Though it predates my use of OSLib.)

I'd be happier if it were maybe OSCore, OSComputer, OSUser and OSToolbox perhaps.

~A.

-- 
 -----------------------------------------------------------
   / Ainsley Pereira       /   aka Marble on Snowplains   /
  /                       / telnet://snowplains.org:3456 /
 ------------------------------------------------------------



More information about the oslib-user mailing list