POV-Ray : Newsgroups : povray.off-topic : The marvels of Win32 : Tag lists Server Time
28 Sep 2024 21:22:24 EDT (-0400)
  Tag lists  
From: Invisible
Date: 13 Oct 2009 04:35:36
Message: <4ad43bd8$1@news.povray.org>
Invisible wrote:
> You know, if you sit down and read this stuff, there's actually a *hell* 
> of a lot of switches and options in there...
> 
> Like, you'd think creating a window would just be "hey, please create a 
> window with this title please". But no. Apart from being able to specify 
> the title, icon, and initial size and place, you can do a whole heap of 
> other things:
> 
> And you thought you could just OPEN a window... ha!

The way AmigaOS handled this stuff was to use tag lists.

If you call OpenWindowTagList(null), it opens an untitled window on the 
current screen, taking up most but not all of the display, with the 
default window gadgets. Instead of a null pointer, you can (and usually 
do) pass a pointer to a "tag list". This is simply an array of key/value 
pairs (ending with a TAG_DONE key).

I don't recall the symbol names off the top of my head any more, but you 
could add a TAG_TITLE key, with a string pointer as the value, and the 
window would then have that title. Or you could add TAG_LEFT and set the 
X coordinate for the left edge of the window.

Basically, with each new release of the OS, they just added some more 
tag IDs to the header files. So rather than remembering a bunch of 
function parameters, or even having a struct full of fields that you 
append to, you have this tag list which has any combination of values, 
listed in any order. Each time they need to add a new tag, they just add 
a new ID.

Now if you have a 32-bit bitmap, you can specify 32 flags. But if you 
have 32-bit tag IDs, you have four billion possible tag IDs - which 
you're never likely to run out of! (The header file would be several 
gigabytes in size, back in a day when everybody worked off 720KB floppy 
disks.)

This simple idea makes it trivial to expand the OS, trivial for the OS 
to parse the window spec, and trivial for the application to write the 
window spec. (It could be static data, for example. Or dynamically 
written. Or whatever.) And AmigaOS used it for much more than just 
creating windows, of course.

(Tag lists didn't exist under Kickstart 1.3. It was only added with 
Kickstart 2.0.)

Oddly, this feature doesn't seem to be apparent anywhere in Win32. It 
seems the Win32 Way(tm) is to have a big struct, and pass in a pointer 
to the struct and also a length indication, and the function you're 
calling decides which version of the struct you've given it based on the 
length...


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.