commit e5ff2e7d454efa06dfa926cca107f302e93c7256
parent 154bff7636f02bcb642796da2e66602e589db838
Author: William Casarin <jb55@jb55.com>
Date: Wed, 20 Dec 2017 13:49:40 -0800
misc: cleanups
Diffstat:
4 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/main.c b/main.c
@@ -15,6 +15,13 @@ u32 g_reader_buf_cap;
void yyerror(const char* s);
+
+void
+parse_error(char* err) {
+ fprintf(stderr, "[btcs] parse error: %s\n", err);
+ exit(1);
+}
+
int main() {
yyin = stdin;
@@ -70,9 +77,3 @@ void yyerror(const char* s) {
fprintf(stderr, "Parse error: %s\n", s);
exit(1);
}
-
-void
-parse_error(char* err) {
- fprintf(stderr, "[btcs] parse error: %s\n", err);
- exit(1);
-}
diff --git a/parser.y b/parser.y
@@ -2,6 +2,7 @@
%{
#include <stdio.h>
#include "op.h"
+#include "script.h"
#include "stack.h"
#include "valstack.h"
diff --git a/script.c b/script.c
@@ -761,10 +761,10 @@ script_push_str(struct stack *script, char *str) {
}
void
-script_push_datastr(struct stack *script, char *str) {
+script_push_datastr(struct stack *script, const char *str) {
int count = 0;
u8 *bytes;
- char *p = str;
+ const char *p = str;
u16 ind;
u16 nbytes = strlen(str) / 2;
struct val val;
diff --git a/script.h b/script.h
@@ -16,7 +16,9 @@ int script_eval(const u8 *script, size_t script_size, struct stack *stack,
void script_print_ops(char * buf, size_t size);
void script_print_vals(struct stack *);
void script_push_int(struct stack *, s64);
-void script_push_datastr(struct stack *, char *str);
+
+void script_push_str(struct stack *script, char *str);
+void script_push_datastr(struct stack *, const char *str);
void
script_serialize(struct stack *stack, u8 *buf, int buflen, int* len);