void rpn_pushf(float f) { return rpn_push(sprintf("%.9g", f)); }
void rpn_setf(float f) { return rpn_set(sprintf("%.9g", f)); }
-void GenericCommand_rpn(float request, float argc, string command)
+SHUTDOWN(_rpndb)
+{
+ if(rpn_db)
+ db_close(rpn_db);
+}
+
+void GenericCommand_rpn(int request, int argc, string command)
{
switch(request)
{
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " rpn EXPRESSION...");
- LOG_INFO(" Operator description (x: string, s: set, f: float):");
- LOG_INFO(" x pop -----------------------------> : removes the top");
- LOG_INFO(" x dup -----------------------------> x x : duplicates the top");
- LOG_INFO(" x x exch --------------------------> x x : swap the top two");
- LOG_INFO(" /cvarname load --------------------> x : loads a cvar");
- LOG_INFO(" /cvarname x def -------------------> : writes to a cvar");
- LOG_INFO(" f f add|sub|mul|div|mod|pow -------> f : adds/... two numbers");
- LOG_INFO(" f f and|or|xor|bitand|bitor|bitxor > f : logical and bitwise operations");
- LOG_INFO(" f f eq|ne|gt|ge|lt|le|max|min -----> f : compares two numbers");
- LOG_INFO(" f neg|abs|sgn|rand|floor|ceil------> f : negates/... a number");
- LOG_INFO(" f not|bitnot ----------------------> f : logical and bitwise negation");
- LOG_INFO(" f exp|log|sin|cos -----------------> f : exponential function & Co.");
- LOG_INFO(" f f f bound -----------------------> f : bounds the middle number");
- LOG_INFO(" f1 f2 b when ----------------------> f : f1 if b, f2 otherwise");
- LOG_INFO(" s s union|intersection|difference -> s : set operations");
- LOG_INFO(" s shuffle -------------------------> s : randomly arrange elements");
- LOG_INFO(" /key /value put -------------------> : set a database key");
- LOG_INFO(" /key get --------------------------> s : get a database value");
- LOG_INFO(" x dbpush --------------------------> : pushes the top onto the database");
- LOG_INFO(" dbpop|dbget -----------------------> x : removes/reads DB's top");
- LOG_INFO(" dblen|dbat ------------------------> f : gets the DB's size/cursor pos");
- LOG_INFO(" dbclr -----------------------------> : clear the DB");
- LOG_INFO(" s dbsave|dbload--------------------> : save/load the DB to/from a file");
- LOG_INFO(" x dbins ---------------------------> : moves the top into the DB");
- LOG_INFO(" dbext|dbread ----------------------> x : extract/get from the DB's cursor");
- LOG_INFO(" f dbmov|dbgoto --------------------> : move or set the DB's cursor");
- LOG_INFO(" s localtime -----------------------> s : formats the current local time");
- LOG_INFO(" s gmtime --------------------------> s : formats the current UTC time");
- LOG_INFO(" time ------------------------------> f : seconds since VM start");
- LOG_INFO(" s /MD4 digest ---------------------> s : MD4 digest");
- LOG_INFO(" s /SHA256 digest ------------------> s : SHA256 digest");
- LOG_INFO(" s /formatstring sprintf1s ---------> s : sprintf with 1 string (pad, cut)");
- LOG_INFO(" s eval ----------------------------> : does something eval");
- LOG_INFO(" Set operations operate on 'such''strings'.");
- LOG_INFO(" Unknown tokens insert their cvar value.");
+ LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " rpn EXPRESSION...");
+ LOG_HELP(" Operator description (x: string, s: set, f: float):");
+ LOG_HELP(" x pop -----------------------------> : removes the top");
+ LOG_HELP(" x dup -----------------------------> x x : duplicates the top");
+ LOG_HELP(" x x exch --------------------------> x x : swap the top two");
+ LOG_HELP(" /cvarname load --------------------> x : loads a cvar");
+ LOG_HELP(" /cvarname x def -------------------> : writes to a cvar");
+ LOG_HELP(" f f add|sub|mul|div|mod|pow -------> f : adds/... two numbers");
+ LOG_HELP(" f f and|or|xor|bitand|bitor|bitxor > f : logical and bitwise operations");
+ LOG_HELP(" f f eq|ne|gt|ge|lt|le|max|min -----> f : compares two numbers");
+ LOG_HELP(" f neg|abs|sgn|rand|floor|ceil------> f : negates/... a number");
+ LOG_HELP(" f not|bitnot ----------------------> f : logical and bitwise negation");
+ LOG_HELP(" f exp|log|sin|cos -----------------> f : exponential function & Co.");
+ LOG_HELP(" f f f bound -----------------------> f : bounds the middle number");
+ LOG_HELP(" f1 f2 b when ----------------------> f : f1 if b, f2 otherwise");
+ LOG_HELP(" s s union|intersection|difference -> s : set operations");
+ LOG_HELP(" s shuffle -------------------------> s : randomly arrange elements");
+ LOG_HELP(" /key /value put -------------------> : set a database key");
+ LOG_HELP(" /key get --------------------------> s : get a database value");
+ LOG_HELP(" x dbpush --------------------------> : pushes the top onto the database");
+ LOG_HELP(" dbpop|dbget -----------------------> x : removes/reads DB's top");
+ LOG_HELP(" dblen|dbat ------------------------> f : gets the DB's size/cursor pos");
+ LOG_HELP(" dbclr -----------------------------> : clear the DB");
+ LOG_HELP(" s dbsave|dbload--------------------> : save/load the DB to/from a file");
+ LOG_HELP(" x dbins ---------------------------> : moves the top into the DB");
+ LOG_HELP(" dbext|dbread ----------------------> x : extract/get from the DB's cursor");
+ LOG_HELP(" f dbmov|dbgoto --------------------> : move or set the DB's cursor");
+ LOG_HELP(" s localtime -----------------------> s : formats the current local time");
+ LOG_HELP(" s gmtime --------------------------> s : formats the current UTC time");
+ LOG_HELP(" time ------------------------------> f : seconds since VM start");
+ LOG_HELP(" s /MD4 digest ---------------------> s : MD4 digest");
+ LOG_HELP(" s /SHA256 digest ------------------> s : SHA256 digest");
+ LOG_HELP(" s /formatstring sprintf1s ---------> s : sprintf with 1 string (pad, cut)");
+ LOG_HELP(" s eval ----------------------------> : does something eval");
+ LOG_HELP(" Set operations operate on 'such''strings'.");
+ LOG_HELP(" Unknown tokens insert their cvar value.");
return;
}
}