From 9b499ce88659e97759cd4f8f5846b363553566eb Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Tue, 1 Oct 2013 17:49:44 +0200 Subject: [PATCH] an eval toy for the RPN hackers. RPN probably is turing complete with this. --- qcsrc/common/command/rpn.qc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/qcsrc/common/command/rpn.qc b/qcsrc/common/command/rpn.qc index 66e8554a8..4fc918c4a 100644 --- a/qcsrc/common/command/rpn.qc +++ b/qcsrc/common/command/rpn.qc @@ -535,6 +535,10 @@ void GenericCommand_rpn(float request, float argc, string command) } else if(rpncmd == "sprintf1s") { s = rpn_pop(); rpn_set(sprintf(s, rpn_get())); + } else if(rpncmd == "eval") { + s = rpn_pop(); + tokenize_console(strcat(s, substring(command, argv_end_index(rpnpos), -1))); + rpnpos = -1; } else { rpn_push(cvar_string(rpncmd)); } @@ -587,6 +591,7 @@ void GenericCommand_rpn(float request, float argc, string command) print(" s /MD4 digest ---------------------> s : MD4 digest\n"); print(" s /SHA256 digest ------------------> s : SHA256 digest\n"); print(" s /formatstring sprintf1s ---------> s : sprintf with 1 string (pad, cut)\n"); + print(" s eval ----------------------------> : does something eval\n"); print(" Set operations operate on 'such''strings'.\n"); print(" Unknown tokens insert their cvar value.\n"); return; -- 2.39.2