summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <curtis.mcenroe@adgear.com>2016-10-04 13:22:25 -0400
committerJune McEnroe <curtis.mcenroe@adgear.com>2016-10-04 13:22:25 -0400
commit284577bc303fa38f4df7da2b15e1f7e8e503fefa (patch)
tree93bea0be9f34b0f136f68f1c7b675ff1cba103d6
parentAdd ! to rpn (diff)
downloadsrc-284577bc303fa38f4df7da2b15e1f7e8e503fefa.tar.gz
src-284577bc303fa38f4df7da2b15e1f7e8e503fefa.zip
Add @ to rpn
-rwxr-xr-x.bin/rpn.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/.bin/rpn.c b/.bin/rpn.c
index b7d3e0a1..a33296cf 100755
--- a/.bin/rpn.c
+++ b/.bin/rpn.c
@@ -49,9 +49,15 @@ static int64_t pop(void) {
 }
 
 static bool stack_op(char op) {
+    if (stack.op == '@') {
+        stack.op = 0;
+        while (stack.len > 1)
+            stack_op(op);
+        return true;
+    }
     if (stack.op == '\'') {
-        push(op);
         stack.op = 0;
+        push(op);
         return true;
     }
     if (stack.op == '"') {
@@ -62,9 +68,14 @@ static bool stack_op(char op) {
 
     int64_t a, b;
     switch (op) {
-        case '$': pop();
-        break; case '\\': a = pop(); b = pop(); push(a); push(b);
+        case '@': case '\'': case '"': stack.op = op;
+        break; case 'b': stack.radix = 2;
+        break; case 'o': stack.radix = 8;
+        break; case 'd': stack.radix = 10;
+        break; case 'x': stack.radix = 16;
+        break; case ';': a = pop();
         break; case ':': a = pop(); push(a); push(a);
+        break; case '\\': a = pop(); b = pop(); push(a); push(b);
         break; case '_': a = pop(); push(-a);
         break; case '+': a = pop(); push(pop() + a);
         break; case '-': a = pop(); push(pop() - a);
@@ -80,11 +91,6 @@ static bool stack_op(char op) {
         break; case '>': a = pop(); push(pop() >> a);
         break; case '.': a = pop(); printf("%s\n", fmt(stack.radix, a));
         break; case ',': a = pop(); printf("%c\n", (char) a);
-        break; case 'b': stack.radix = 2;
-        break; case 'o': stack.radix = 8;
-        break; case 'd': stack.radix = 10;
-        break; case 'x': stack.radix = 16;
-        break; case '\'': case '"': stack.op = op;
         break; default: return false;
     }
     return true;
>Lars Hjemli 2009-07-31ui-tree: add support for source-filter optionLars Hjemli 2009-07-31ui-snapshot: use cgit_{open|close}_filter() to execute compressorsLars Hjemli 2009-07-31Add generic filter/plugin infrastructureLars Hjemli 2009-07-25Add support for mime type registration and lookupLars Hjemli 2009-07-25cgit.h: keep config flags sortedLars Hjemli 2009-07-25cgitrc.5.txt: document 'embedded' and 'noheader'Lars Hjemli 2009-07-25Add support for 'noheader' optionLars Hjemli 2009-07-25cgitrc.5.txt: document 'head-include'Lars Hjemli 2009-07-25ui-blob: return 'application/octet-stream' for binary blobsLars Hjemli 2009-07-25ui-plain: Return 'application/octet-stream' for binary files.Remko Tronçon 2009-06-11use cgit_httpscheme() for atom feedDiego Ongaro 2009-06-11add cgit_httpscheme() -> http:// or https://Diego Ongaro 2009-06-07Return http statuscode 404 on unknown branchLars Hjemli 2009-06-07Add head-include configuration option.Mark Lodato 2009-03-15CGIT 0.8.2.1Lars Hjemli 2009-03-15Fix doc-related glitches in Makefile and .gitignoreLars Hjemli 2009-03-15ui-snapshot: avoid segfault when no filename is specifiedLars Hjemli 2009-03-15fix segfault when displaying empty blobsEric Wong 2009-02-19Add support for HEAD requestsLars Hjemli 2009-02-19Add support for ETag in 'plain' viewLars Hjemli 2009-02-12ui-tree: escape ascii-text properly in hexdump viewLars Hjemli 2009-02-12Makefile: add doc-related targetsLars Hjemli