Skip to content

Commit aab9d4b

Browse files
committed
CHANGE: extended possible number of extension command arguments to 15
1 parent ca45cf2 commit aab9d4b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/core/f-extension.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ x*/ int Do_Callback(REBSER *obj, u32 name, RXIARG *args, RXIARG *result)
486486

487487
// Copy args to command frame (array of args):
488488
RXA_COUNT(&frm) = argc = SERIES_TAIL(VAL_FUNC_ARGS(value))-1; // not self
489-
if (argc > 7) Trap0(RE_BAD_COMMAND);
489+
if (argc > MAX_RXI_ARGS) Trap0(RE_BAD_COMMAND);
490490
val = DS_ARG(1);
491491
for (n = 1; n <= argc; n++, val++) {
492492
RXA_TYPE(&frm, n) = Reb_To_RXT[VAL_TYPE(val)];

src/include/reb-ext.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
# endif
4141
#endif
4242

43+
// RXIARG has 16bytes and so there is room only for 15 args, because
44+
// the first RXIARG in the RXIFRM contains types of all used command args.
45+
#define MAX_RXI_ARGS 15
4346

4447
/* Prefix naming conventions:
4548
@@ -65,7 +68,7 @@ typedef union rxi_arg_val {
6568
u64 uint64;
6669
double dec64;
6770
REBXYF pair;
68-
REBYTE bytes[8];
71+
REBYTE bytes[MAX_RXI_ARGS+1];
6972
struct {
7073
i32 int32a;
7174
i32 int32b;
@@ -111,7 +114,7 @@ typedef union rxi_arg_val {
111114

112115
// Command function call frame:
113116
typedef struct rxi_cmd_frame {
114-
RXIARG args[12]; // arg values (128 bits each)
117+
RXIARG args[MAX_RXI_ARGS+1]; // arg values (128 bits each)
115118
} RXIFRM;
116119

117120
typedef struct rxi_cmd_context {

0 commit comments

Comments
 (0)