grub2: bring back build of aros-side grub2 tools
[AROS.git] / test / uae / nodes.h
blob397753e10610e753b292cbe34d04693b93eb92ce
1 #ifndef EXEC_NODES_H
2 #define EXEC_NODES_H
3 /* Copyright © 1995-2011, 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 struct Node
101 NodePtr ln_Succ,
102 ln_Pred;
103 UBYTE ln_Type;
104 BYTE ln_Pri;
105 /* AROS: pointer should be 32bit aligned, but we can not do this on
106 the native machine because of binary compatibility.
108 STRPTR ln_Name;
110 public:
111 inline Node () { return; }
114 struct MinNode
116 MinNodePtr mln_Succ,
117 mln_Pred;
119 public:
120 inline MinNode () { return; }
124 /**************************************
125 Defines
126 **************************************/
127 /* Values for ln_Type */
128 #define NT_UNKNOWN 0 /* Unknown node */
129 #define NT_TASK 1 /* Exec task */
130 #define NT_INTERRUPT 2 /* Interrupt */
131 #define NT_DEVICE 3 /* Device */
132 #define NT_MSGPORT 4 /* Message-Port */
133 #define NT_MESSAGE 5 /* Indicates message currently pending */
134 #define NT_FREEMSG 6
135 #define NT_REPLYMSG 7 /* Message has been replied */
136 #define NT_RESOURCE 8
137 #define NT_LIBRARY 9
138 #define NT_MEMORY 10
139 #define NT_SOFTINT 11 /* Internal flag used by SoftInits */
140 #define NT_FONT 12
141 #define NT_PROCESS 13 /* AmigaDOS Process */
142 #define NT_SEMAPHORE 14
143 #define NT_SIGNALSEM 15 /* signal semaphores */
144 #define NT_BOOTNODE 16
145 #define NT_KICKMEM 17
146 #define NT_GRAPHICS 18
147 #define NT_DEATHMESSAGE 19
149 #define NT_USER 254 /* User node types work down from here */
150 #define NT_EXTENDED 255
153 /******************************************************************************
154 ***** ENDE exec/nodes.h
155 ******************************************************************************/
157 #endif /* EXEC_NODES_H */