Skip to content

Commit 22b8224

Browse files
committed
FIX: lost index information when passing image value between core and extension
resolves: Oldes/Rebol-issues#1809
1 parent 9598e6e commit 22b8224

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/core/f-extension.c

+2
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ x*/ RXIARG Value_To_RXI(REBVAL *val)
113113
arg.series = VAL_SERIES(val);
114114
arg.width = VAL_IMAGE_WIDE(val);
115115
arg.height = VAL_IMAGE_HIGH(val);
116+
arg.index = VAL_INDEX(val);
116117
break;
117118
case RXE_TUPLE:
118119
arg.tuple_len = VAL_TUPLE_LEN(val);
@@ -165,6 +166,7 @@ x*/ void RXI_To_Value(REBVAL *val, RXIARG arg, REBCNT type)
165166
VAL_SERIES(val) = arg.series;
166167
VAL_IMAGE_WIDE(val) = arg.width;
167168
VAL_IMAGE_HIGH(val) = arg.height;
169+
VAL_INDEX(val) = arg.index;
168170
break;
169171
case RXE_TUPLE:
170172
VAL_TUPLE_LEN(val) = arg.tuple_len;

src/os/host-ext-test.c

+11-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ char *RX_Spec =
8484
"hob1: command [{creates XTEST handle}]"
8585
"hob2: command [{prints XTEST handle's data} hndl [handle!]]"
8686
"str0: command [{return a constructed string}]"
87+
"echo: command [{return the input value} value]"
8788

8889
"a: b: c: h: x: none\n"
90+
"i: make image! 2x2\n"
8991
"xtest: does [\n"
9092
"foreach blk [\n"
9193
"[x: hob1]"
@@ -115,7 +117,12 @@ char *RX_Spec =
115117
"[vec0 make vector! [integer! 16 [1 2 3]]]\n"
116118
"[vec1 object [v: make vector! [integer! 16 [1 2 3]]]]\n"
117119
"[blk1 [read %img /at 1]]\n"
118-
"[str0]"
120+
"[str0]\n"
121+
122+
// https://github.com/Oldes/Rebol-issues/issues/1809
123+
"[echo i]\n"
124+
"[probe i probe echo i]\n"
125+
"[loop 1 [probe echo i]]\n"
119126
"][\n"
120127
"print [{^/^[[7mtest:^[[0m^[[1;32m} mold blk {^[[0m}]\n"
121128
//"replace {x} {x} {y}\n"
@@ -343,13 +350,15 @@ RXIEXT int RX_Call(int cmd, RXIFRM *frm, void *ctx) {
343350
REBSER* str = RL_MAKE_STRING(32, FALSE); // 32 bytes, latin1 (must be large enough!)
344351
REBYTE ver[8];
345352
RL_VERSION(ver);
346-
sprintf_s(SERIES_DATA(str), SERIES_REST(str), "Version: %i.%i.%i", ver[1], ver[2], ver[3]);
353+
snprintf(SERIES_DATA(str), SERIES_REST(str), "Version: %i.%i.%i", ver[1], ver[2], ver[3]);
347354
SERIES_TAIL(str) = strlen(SERIES_DATA(str));
348355
RXA_SERIES(frm, 1) = str;
349356
RXA_TYPE (frm, 1) = RXT_STRING;
350357
RXA_INDEX (frm, 1) = 0;
351358
}
352359
break;
360+
case 19: //command [{return the input value} value]
361+
return RXR_VALUE;
353362

354363
default:
355364
return RXR_NO_COMMAND;

0 commit comments

Comments
 (0)