Skip to content

Commit 43c02f9

Browse files
committed
FEAT: handle's context accessible from an external extension
1 parent e7273ea commit 43c02f9

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/include/reb-ext.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ typedef union rxi_arg_val {
7373
int height:16;
7474
};
7575
struct {
76-
void *ptr;
76+
union {
77+
void *ptr;
78+
REBHOB *hob; // Handle's context object
79+
};
7780
REBCNT type; // Handle's name (symbol)
7881
REBFLG flags:16; // Handle_Flags
7982
REBCNT index:16; // Index into Reb_Handle_Spec value
@@ -127,6 +130,7 @@ typedef int (*RXICAL)(int cmd, RXIFRM *args, REBCEC *ctx);
127130
#define RXA_OBJECT(f,n) (RXA_ARG(f,n).addr)
128131
#define RXA_MODULE(f,n) (RXA_ARG(f,n).addr)
129132
#define RXA_HANDLE(f,n) (RXA_ARG(f,n).handle.ptr)
133+
#define RXA_HANDLE_CONTEXT(f,n) (RXA_ARG(f,n).handle.hob)
130134
#define RXA_HANDLE_TYPE(f,n) (RXA_ARG(f,n).handle.type)
131135
#define RXA_HANDLE_FLAGS(f,n) (RXA_ARG(f,n).handle.flags)
132136
#define RXA_HANDLE_INDEX(f,n) (RXA_ARG(f,n).handle.index)

src/include/sys-value.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,10 @@ typedef struct Reb_Handle_Spec {
10911091
} REBHSP;
10921092

10931093
typedef struct Reb_Handle_Context {
1094-
REBYTE *data; // Pointer to raw data
1094+
union {
1095+
REBYTE *data; // Pointer to raw data
1096+
void *handle; // Unspecified pointer (external handle)
1097+
};
10951098
REBCNT sym; // Index of the word's symbol. Used as a handle's type!
10961099
REBFLG flags:16; // Handle_Flags (HANDLE_CONTEXT_MARKED and HANDLE_CONTEXT_USED)
10971100
REBCNT index:16; // Index into Reb_Handle_Spec value

0 commit comments

Comments
 (0)