Copy/paste coding error... no more commits for a while...
[AROS.git] / test / uae / nodes.h
bloba39d2a1f2e7d86fce4ea8998c0ad719e302a8310
1 #ifndef EXEC_NODES_H
2 #define EXEC_NODES_H
3 /* Copyright © 1995, The AROS Development Team. All rights reserved. */
5 /******************************************************************************
7 MODUL
8 $Id$
10 DESCRIPTION
11 Header-file for nodes.
13 ******************************************************************************/
15 /**************************************
16 Includes
17 **************************************/
18 /* #ifndef AROS_CONFIG_H
19 # include <aros/config.h>
20 #endif
21 #ifndef EXEC_TYPES_H
22 # include <exec/types.h>
23 #endif */
24 #include "types.h"
26 class NodePtr : APTR
28 public:
29 /* Here I overload the -> (dereference) operator. When you dereferenece
30 a NodePtr, then you get a struct Node *. Here is how it works:
32 NodePtr nptr;
34 ... give nptr a valid value ...
36 name = nptr->ln_Name;
38 The C++ compiler creates this code for the last line:
40 struct Node * temp = nptr.operator-> ();
41 name = temp->ln_Name;
43 This means that you can use any field name which is valid after
44 "struct Node *" after an NodePtr.
46 inline struct Node * operator -> ()
48 return (struct Node *) ntohl (data);
51 /* Convert a NodePtr to a Node */
52 inline operator struct Node * ()
54 return (struct Node *) ntohl (data);
57 /* Convert it to void * */
58 inline operator void * ()
60 return (struct Node *) ntohl (data);
63 /* Create a NodePtr from a struct Node pointer. */
64 inline NodePtr (struct Node * v)
66 data = htonl ((long)v);
69 inline NodePtr ()
71 return;
75 /* Pretty much the same but this time for MinNodePtr */
76 class MinNodePtr : APTR
78 public:
79 inline struct MinNode * operator -> ()
81 return (struct MinNode *) ntohl (data);
84 inline MinNodePtr (struct MinNode * v)
86 data = htonl ((long)v);
89 inline MinNodePtr ()
91 return;
95 /**************************************
96 Structures
97 **************************************/
99 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT)
100 struct Node
102 NodePtr ln_Succ,
103 ln_Pred;
104 UBYTE ln_Type;
105 BYTE ln_Pri;
106 /* AROS: pointer should be 32bit aligned, but we can not do this on
107 the native machine because of binary compatibility.
109 STRPTR ln_Name;
111 public:
112 inline Node () { return; }
115 #else
116 struct Node
118 NodePtr ln_Succ,
119 ln_Pred;
120 /* AROS: pointer should be 32bit aligned */
121 STRPTR ln_Name;
122 UBYTE ln_Type;
123 BYTE ln_Pri;
125 public:
126 inline Node () { return; }
128 #endif /* AROS_FLAVOUR */
130 struct MinNode
132 MinNodePtr mln_Succ,
133 mln_Pred;
135 public:
136 inline MinNode () { return; }
140 /**************************************
141 Defines
142 **************************************/
143 /* Values for ln_Type */
144 #define NT_UNKNOWN 0 /* Unknown node */
145 #define NT_TASK 1 /* Exec task */
146 #define NT_INTERRUPT 2 /* Interrupt */
147 #define NT_DEVICE 3 /* Device */
148 #define NT_MSGPORT 4 /* Message-Port */
149 #define NT_MESSAGE 5 /* Indicates message currently pending */
150 #define NT_FREEMSG 6
151 #define NT_REPLYMSG 7 /* Message has been replied */
152 #define NT_RESOURCE 8
153 #define NT_LIBRARY 9
154 #define NT_MEMORY 10
155 #define NT_SOFTINT 11 /* Internal flag used by SoftInits */
156 #define NT_FONT 12
157 #define NT_PROCESS 13 /* AmigaDOS Process */
158 #define NT_SEMAPHORE 14
159 #define NT_SIGNALSEM 15 /* signal semaphores */
160 #define NT_BOOTNODE 16
161 #define NT_KICKMEM 17
162 #define NT_GRAPHICS 18
163 #define NT_DEATHMESSAGE 19
165 #define NT_USER 254 /* User node types work down from here */
166 #define NT_EXTENDED 255
169 /******************************************************************************
170 ***** ENDE exec/nodes.h
171 ******************************************************************************/
173 #endif /* EXEC_NODES_H */