IPS(Interpreter for Process Structures) for mbed

Dependencies:   ConfigFile FATFileSystem mbed

IPS port from linux/unix version.

mbed_blinky.ips

0 VAR led1
" LED1 " DigitalOut led1 !
: main
    ANFANG
    1 JA?
      1 led1 @ write
      200 wait_ms
      0 led1 @ write
      200 wait_ms
    DANN/NOCHMAL
;
main
Revision:
2:908338b1151a
Parent:
1:e74530ad6b9e
--- a/VideoRAM.h	Wed May 13 18:39:01 2015 +0900
+++ b/VideoRAM.h	Sat May 23 16:50:59 2015 +0900
@@ -1,9 +1,14 @@
+// VideoRAM.h 2015/5/22
 #pragma once
 
+template<class SERIAL_T>
 class VideoRAM {
+    SERIAL_T& _pc;
+    uint16_t x, y;
+    bool f_init;
+
 public:
-    VideoRAM(RawSerial& pc):_pc(pc),x(0),y(0) {
-        _puts("\x1b[2J"); // erase
+    VideoRAM(RawSerial& pc):_pc(pc),x(0),y(0),f_init(false) {
     }
     void vpoke(uint16_t i, uint8_t b) {
         if (i < 1024) {
@@ -20,15 +25,20 @@
     }
 
 private:
+    void init() {
+        _puts("\x1b[2J"); // erase
+    }
     void _puts(const char* s) {
         while(*s) {
             _putc(*s++);
         }
     }
     void _putc(int c) {
+        if (!f_init) {
+            f_init = true;
+            init();
+        }
         _pc.putc(c);
     }
-    RawSerial& _pc;
-    uint16_t x, y;
 };