Skip to content

Commit

Permalink
FEAT: store last console result in system/state/last-result
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Jul 23, 2021
1 parent b150eb9 commit f1b74c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/boot/sysobj.reb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ state: object [
0.0.0
extension: 2.2.2 ; execute only
]
last-error: none ; used by WHY?
last-error: none ; used by WHY?
last-result: none ; used to store last console result
]

modules: []
Expand Down
5 changes: 4 additions & 1 deletion src/core/a-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ extern int Do_Callback(REBSER *obj, u32 name, RXIARG *args, RXIARG *result);
REBVAL *top = DS_VALUE(dsp+1);
REBOL_STATE state;
REBVAL *types;
REBVAL *last;

if (dsp != 0) Debug_Fmt(Str_Stack_Misaligned, dsp);

Expand Down Expand Up @@ -487,7 +488,9 @@ extern int Do_Callback(REBSER *obj, u32 name, RXIARG *args, RXIARG *result);
}
}
}

// store last result in system/state/last-result
last = Get_System(SYS_STATE, STATE_LAST_RESULT);
*last = *top;
POP_STATE(state, Saved_State);
DSP = 0;
}
Expand Down

0 comments on commit f1b74c7

Please sign in to comment.