From 275677dd44b18b1cef3acfa30f52d8afa562b639 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Mon, 2 Apr 2018 12:29:22 -0400 Subject: [PATCH] libinterp changes --- libinterp.a | Bin 65754 -> 66016 bytes src/main.c | 26 +++++++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/libinterp.a b/libinterp.a index 04391e1deab3ed92d758cec68b99c0349ca1cd77..46f2a26b7188d1666eb6ef155e4bad47fe15995b 100644 GIT binary patch delta 7093 zcmbtZ33OCdn!fi{DkPPK01~oMRu+@0RFRE@gn*EQ5LqQnBZL@D1q!SPVuYxH(0M_? zgjI@*;6MaKWK~F~P#7Q(TCnZL1*UPDZ8UgnL0bjUGthuC-~ZmNSa^E+%sKPUdGEX5 zzuo`-cd1uZ=NANYE(}-|rw+&)kdu{Vv1C~2@_$+^xf$7-)M9a(7-It&GX(tK@3ei4 z(VhRwzqr+ZrTkxXvysdH_wKmE7~MVT@#&BLx40Oe>#gMZyjPXWHM4rwG*(?xHG2+V z_Or9ZHpLyN*GxooM0!&VYwZ5~eA@dVeq71S77jxyKkWT`{tP33Kujta7G&tW?H+fH zDZ(;zqW4yTRZ-YcF=|+xcgV0<&J(=l#ruQRuUat5nr@7>0eMRpCcrwI@vk1|j47U4 zYgJdf#yX{|J(H!R8eo5kynhbV>%?0|OYcj5-mzaQ8pW#01SKX=EO#a-%XRo!1773Z>#S79Qiz_6vuVKJ%S?&S0FRXeCr+z$ zg&&^_e%Ftq%Iq2Mqf4<~qrDZg(|8(7JmkE;v)&!!KIFc@dKJgk8LovJF0?83pwqudA9Y8S+`aMh zU9o;nT5 zJq$l}%RNdR-K${aC{Yx6nw0s~dN)I`{b)2Cqha>oQ@ZX<)J-ixLrJ33*y(StThrJB z?SZF$VL|q2#O3|#t9;h;+&!x2xyM(pW~SmE?s?TJHF{!XzXW6n7^if)-@fs`Si-<+ zy)sHky?cFCy?aA7vl~w5Rnti0I%7ua+5@Q0hU(b5cYi1{oN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a?#6YrWt z$C!LkaH3Vg-vB>Yo}zc+)VaksCoDQFQAGafN5VNUY;fE;5F*M?n)I}MgE(uC63?F; zrjGzyDZD2w`g1q}uZXuWT8C2^FFwO)7rHu${zNPiPYqMtGezd9H2pCMvsGcusbTsr z!Cn^YPFa-ZnfL>9v^Wl76VCBGaTdZ0x#AFnrk-JX6K<0Rk=$d^x6Q=;Bxdzkl%}y_ xc~6@DIF4PZ_*bY*yiG>4a0Jz9zV8Y8`*gJ5@%F_B1OIJ__{)bW{|gA_G-3b% diff --git a/src/main.c b/src/main.c index b39053a..79f3e92 100644 --- a/src/main.c +++ b/src/main.c @@ -90,12 +90,14 @@ void task_interpreter(void) instance *it = inewinstance(); script_loadlib(it); + // load '/init' file char *s = initrd_readfile("init"); if (s == 0) { dsp_puts("can't find init"); goto end; } + // read in, parse into script code char *linebuf = (char *)malloc(120); uint32_t i = 0, prev = 0, lc; uint32_t size = initrd_filesize("init"); @@ -109,21 +111,27 @@ void task_interpreter(void) } strncpy(linebuf, s + prev, lc + 1); linebuf[lc] = '\0'; - ret = idoline(it, linebuf); - if (ret < 0) - break; + ret = iaddline(it, linebuf); + if (ret != 0) + goto fail; prev = ++i; } - - if (ret < 0) { - dsp_puts("\nError: "); - dsp_puts(itoa(ret, linebuf, 10)); - } free(linebuf); - //iend(&it); // nah + + // run the script + ret = irun(it); + if (ret != 0) + goto fail; + idelinstance(it); end: while (1) delay(10); +fail: + if (ret < 0) { + dsp_puts("\nError: "); + dsp_puts(itoa(ret, linebuf, 10)); + } + goto end; }