AMIGA alive

AMIGA alive
Showing posts with label ndk. Show all posts
Showing posts with label ndk. Show all posts

Friday, November 8, 2024

A little odd: TAG_DONE and TAG_END

Sometimes one might get confused when to use TAG_DONE in AmigaOS C-code, and when to use TAG_END. The answer is very simple: They're one and the same. But it turns out there might be a little bit of an unknown story to these two widely used tokens.

TAG_DONE showed up before TAG_END, in NDK1.3, along with struct TagItem, but not as part of the system includes, and the TagItem system wasn't used in system functions.

Or was it? This is a section of code from the file Read-Me1.3/A2024Docs/OpenA2024.c, which is part of NDK1.3.

#define NONEWINCLUDES       1   /* don't have 1.3 includes yet  */

#if NONEWINCLUDES       /* Some additional definitions  */

/********** from intuition/screens.h ************/

#define NS_EXTENDED     0x1000  /* NewScreen.Extension is valid     */

struct TagItem
{
    ULONG   ti_Tag;     /* identifies the type of this item */
    ULONG   ti_Data;    /* type-specific data, can be a pointer */
};

/* ---- system tag values ----------------------------- */
#define TAG_DONE   (0L) /* terminates array of TagItems. ti_Data unused */
#define TAG_IGNORE (1L) /* ignore this item, not end of array       */
#define TAG_MORE   (2L) /* ti_Data is pointer to another array of TagItems
             * note that this tag terminates the current array
             */

Note the condition "#if NONEWINCLUDES". It looks as if these definitions were part of some "new includes" that weren't part of the distribution (yet?). 

There appears to be a nice little oddity here:

NS_EXTENDED (and TagItem) can't be found in intuition/screens.h, while other sections of the code (not shown here) can. The code contains a copy of NewScreen structure definition, only extended with an extra field, type TagItem pointer. It then creates an instance of that NewScreen structure, with type NS_EXTENDED, and calls OpenScreen() with that structure. There's no mentioning of NS_EXTENDED, or a TagItem pointer field in the Autodocs of OpenScreen() in this version of the NDK.

Does that mean that AmigaOS1.3 already had an (almost) undocumented feature, that would only be made (really) public with AmigaOS2?

TAG_END appears in NDK2.0, in new system include file utility/tagitem.h, as a clone of TAG_DONE, along with struct TagItem etc.:

NDK2.0-4/include/utility/tagitem.h

#define TAG_DONE   (0L) /* terminates array of TagItems. ti_Data unused */
#define TAG_END TAG_DONE

This NDK's version of intuition/screens.h also defines an ExtNewScreen structure that has the extra TagItem pointer field. 

Looking at the usage of TAG_DONE and TAG_END, across all files that are supplied with NDK2.0, there seems to be no preference. Maybe TAG_END was really just introduced to avoid interruptions in workflow, because many developers would intuitively think, and type, "end" instead of "done"?

Another tiny oddity is a change that appears in NDK3.1. It has a slightly different definition of TAG_END: It's still identical, but for some unexplainable reason, TAG_END isn't bound to TAG_DONE anymore. Instead, a comment explains why both use the same value.

Includes\&Libs/include_h/utility/tagitem.h

#define TAG_DONE (0L) /* terminates array of TagItems. ti_Data unused */
#define TAG_END (0L) /* synonym for TAG_DONE */

We'll probably never find out what happened, precisely.
But that's ok. Fortunately, TAG_DONE and TAG_END are either synonyms, or simply the same. ;-)



Friday, July 2, 2021

AmigaOS 3.2 Native Developer Kit updated, rel. 3

Hyperion and the team of AmigaOS 3.2 developers show their dedication with an updated release of the Native Developer Kit.

The new NDK was released on June 30th 2021. According to the file description, it improves compatibility with different compiler environments. Also there seem to be "strategic" changes, simplifying future updates (see "ReadMe" picture below).

Probably not directly related to the NDK's contents, but also mentioned in the file details is what appears to be a new strategy of distribution with wider availability through additional sources.

An odd feature of this latest release (just like rel. 2) might be that it's incomplete by design (see "ReadMe" picture below), and it speaks of a "worthwhile endeavour" of "seeking out on earlier NDKs" - umh, maybe not exactly "worthwhile". (But we've done the work for you, see link at end of article.)

Whatever the case, this is certainly another welcome update, and a must-have for all Amiga developers.

A look at the NDK3.2R3 ReadMe file

Go to Hyperion's website to download AmigaOS 3.2 Native Developer Kit release 3:
https://www.hyperion-entertainment.com/index.php/downloads?view=files&parent=40

If you don't have one of the earlier - complete - NDKs, you can get the "Amiga Developer CD 2.1" with NDK3.9 (yes, 3.9 comes before 3.2 in Amiga land) and lots of other stuff from your preferred vendor, or download NDK3.9 from Haage&Partner's website - here's a link: https://www.haage-partner.de/download/AmigaOS/NDK39.lha