Browse Source

cloc update, remote shell test

mntmn 8 years ago
parent
commit
9871e78202
5 changed files with 29 additions and 35 deletions
  1. 3 1
      cloc.sh
  2. 0 1
      sledge/compiler_new.c
  3. 0 0
      sledge/eval.c
  4. 0 24
      sledge/machine.h
  5. 26 9
      sledge/tests/shell.l

+ 3 - 1
cloc.sh

@@ -1,4 +1,6 @@
 #!/bin/sh
 # calculate the number of code lines of the OS
 
-cloc sledge/*.c sledge/*.h
+cloc sledge/alloc* sledge/compiler_arm_new* sledge/jit_arm* sledge/minilisp* sledge/reader* sledge/sledge.c sledge/stream* sledge/strmap* sledge/writer* os/libc* os/mini-ip* devices/rpi2/arm_start.S devices/rpi2/dev_eth* devices/rpi2/fatfs* devices/rpi2/main* devices/rpi2/mmu* devices/rpi2/raspi* devices/rpi2/uart* devices/rpi2/uspi_glue*    devices/rpi2/rpi-boot/fat* devices/rpi2/rpi-boot/emmc* devices/rpi2/rpi-boot/block* devices/rpi2/rpi-boot/libfs* devices/rpi2/rpi-boot/vfs* devices/rpi2/rpi-boot/timer* devices/rpi2/rpi-boot/mbox* devices/rpi2/rpi-boot/mbr*   devices/rpi2/uspi/env/lib/timer.c devices/rpi2/uspi/env/lib/interrupt.c devices/rpi2/uspi/env/lib/memio.c devices/rpi2/uspi/env/lib/assert.c devices/rpi2/uspi/env/lib/bcmpropertytags.c devices/rpi2/uspi/env/lib/bcmmailbox.c devices/rpi2/uspi/env/lib/exceptionstub.S devices/rpi2/uspi/env/lib/exceptionhandler.c devices/rpi2/uspi/lib/*.c
+
+cloc --force-lang="Lisp",l sledge/tests/shell.l sledge/tests/editlite.l

+ 0 - 1
sledge/compiler_new.c

@@ -2,7 +2,6 @@
 #include "reader.h"
 #include "writer.h"
 #include "alloc.h"
-#include "machine.h"
 #include "compiler_new.h"
 #include "stream.h"
 #include "utf8.c"

+ 0 - 0
sledge/eval.c


+ 0 - 24
sledge/machine.h

@@ -1,24 +0,0 @@
-#include "minilisp.h"
-#include <stdint.h>
-
-#define SCREEN_W 640
-#define SCREEN_H 480
-#define COLOR_TYPE uint8_t
-#define SCREEN_BPP 1 // bytes per pixel
-
-int machine_video_set_pixel(uint32_t x,uint32_t y,COLOR_TYPE c);
-int machine_video_rect(uint32_t x,uint32_t y,uint32_t w,uint32_t h,COLOR_TYPE c);
-int machine_video_flip();
-
-int machine_get_key();
-int machine_get_modifiers();
-
-Cell* machine_save_file(Cell* cell, char* path);
-Cell* machine_load_file(char* path);
-
-Cell* machine_poll_udp();
-Cell* machine_send_udp(Cell* data_cell);
-
-Cell* machine_connect_tcp(Cell* host_cell, Cell* port_cell, Cell* connected_fn_cell, Cell* data_fn_cell);
-Cell* machine_send_tcp(Cell* data_cell);
-Cell* machine_bind_tcp(Cell* port_cell, Cell* fn_cell);

+ 26 - 9
sledge/tests/shell.l

@@ -299,6 +299,28 @@
 
 (def temp-minx minx)
 (def temp-maxx maxx)
+
+
+(def irc-msg (fn msg (do
+  (let ircbuf (concat "PRIVMSG #nodrama.de :" msg))
+  (print (list "ircbuf:" ircbuf))
+  (send net ircbuf)
+  (send net [0a])
+)))
+
+(def cmdbuf (alloc-str 512))
+(def remote-cmd (fn msg (do
+  (let parts (split msg "$"))
+  (if (gt (list-size parts) 1) (do
+    (let cmd (concat (concat "(" (item parts 1)) ")"))
+    (print (list "remote cmd" cmd))
+    (def cmdbuf (alloc-str 512))
+    (write (eval (read cmd)) cmdbuf)
+    (print (list "result" cmdbuf))
+    (irc-msg cmdbuf)
+  ) 0)
+  0
+)))
       
 (def net-test (fn (do
   (def net (open "/net/tcp/62.231.75.133/6667"))
@@ -311,15 +333,17 @@
       (def minx 1000)
       (def maxx 1800)
       (print "about to print packet")
-      (print (bytes->str packet))
+      (let msg (bytes->str packet))
       
-      (let ofsy (blit-str (bytes->str packet) minx net-y))
+      (let ofsy (+ (blit-str msg minx net-y) rune-h))
       (print (list "ofsy" ofsy))
       
       (def minx temp-minx)
       (def maxx temp-maxx)
       (def net-y (+ 0 ofsy))
       (if (gt net-y maxy) (def net-y miny) 0)
+
+      (remote-cmd msg)
       
     ) 0)
   )))
@@ -336,13 +360,6 @@
   (send net [0a])
 )))
 
-(def irc-msg (fn msg (do
-  (let ircbuf (concat "PRIVMSG #nodrama.de :" msg))
-  (print (list "ircbuf:" ircbuf))
-  (send net ircbuf)
-  (send net [0a])
-)))
-
 (def task-func (fn (print "hello from placeholder")))
 
 (def run-tasks (fn (do