ref: ee088488b4e8adc5cdb7ba02d7906d3f370a453c
parent: b3610440c27ad0b930290179daf1f18d5a675686
author: Noam Preil <noam@pixelhero.dev>
date: Tue Jun 1 13:07:10 EDT 2021
add opfind
--- a/op.c
+++ b/op.c
@@ -851,4 +851,23 @@
{"copy", t4copy, -1,},
{"index", t4index, -1,},
{"roll", t4roll, -2,},
+
+ /* terminator */
+ {nil, nil, 0},
};
+
+Op *
+opfind(char *name)
+{
+ int i;
+ Op *op;
+ i = 0;
+ op = &ops[0];
+ while(op->s != nil){
+ if(strcmp(op->s, name) == 0)
+ return op;
+ i += 1;
+ op = &ops[i];
+ }
+ return nil;
+}