picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

mkJar (3044B)


      1 #!./pil
      2 # 17jul12abu
      3 # (c) Software Lab. Alexander Burger
      4 
      5 (load "../src64/version.l")
      6 
      7 # Build Ersatz PicoLisp
      8 
      9 (de declLocal (Vars Typ Lst)
     10    (when (filter '((S) (memq S Lst)) Vars)
     11       (prinl "         " Typ " " (glue ", " @) ";") ) )
     12 
     13 (out "PicoLisp.java"
     14    (in "sys.src"
     15       (echo "<VERSION>")
     16       (prin (glue "," *Version))
     17       (echo "<SYM>")
     18       (let Cnt (read)
     19          (in "fun.src"
     20             (skip "#")
     21             (loop
     22                (let Name (till " " T)
     23                   (prinl
     24                      "mkSymbol(new Number(\""
     25                      (inc 'Cnt)
     26                      "\"), \""
     27                      Name
     28                      "\", Pico);" ) )
     29                (while (line))
     30                (prin "      ")
     31                (NIL (skip "#")) ) )
     32          (prinl "MaxFun = " Cnt ";")
     33          (prin "      ") )
     34       (skip)
     35       (echo "<FUN>")
     36       (let Cnt (read)
     37          (in "fun.src"
     38             (skip "#")
     39             (loop
     40                (let (Name (till " " T)  Vars (read))
     41                   (line)
     42                   (prinl
     43                      "case "
     44                      (inc 'Cnt)
     45                      ":  // "
     46                      Name )
     47                   (if (=T Vars)
     48                      (while (line)
     49                         (prinl "            " @) )
     50                      (prinl "               " "return do" Cnt "(ex);")
     51                      (while (line)) ) )
     52                (prin "            ")
     53                (NIL (skip "#")) ) ) )
     54       (skip)
     55       (echo "<DEF>")
     56       (let Cnt (read)
     57          (in "fun.src"
     58             (skip "#")
     59             (loop
     60                (inc 'Cnt)
     61                (let (Name (till " " T)  Vars (read))
     62                   (line)
     63                   (if (=T Vars)
     64                      (while (line))
     65                      (prinl
     66                         "final static Any do"
     67                         Cnt
     68                         "(Any ex) { // "
     69                         Name )
     70                      (declLocal Vars "int" '(i j k))
     71                      (declLocal Vars "char" '(c))
     72                      (declLocal Vars "long" '(n))
     73                      (declLocal Vars "Any" '(w x y z lst))
     74                      (declLocal Vars "Symbol" '(s t))
     75                      (declLocal Vars "Number" '(num))
     76                      (declLocal Vars "String" '(str txt))
     77                      (declLocal Vars "StringBuilder" '(sb))
     78                      (declLocal Vars "Any[]" '(v))
     79                      (declLocal Vars "Bind" '(bnd))
     80                      (declLocal Vars "Object" '(o))
     81                      (while (line)
     82                         (prinl "      " @) )
     83                      (prinl "      }")
     84                      (prinl)
     85                      (prin "      ") ) )
     86                (NIL (skip "#")) ) ) )
     87       (skip)
     88       (echo) ) )
     89 
     90 (when (call "javac" "-O" "-g:none" "PicoLisp.java")
     91    (let Lst (filter '((F) (tail '`(chop ".class") (chop F))) (dir))
     92       (apply call Lst "jar" "cmf" "Manifest" "picolisp.jar")
     93       (apply call Lst "rm") ) )
     94 
     95 (bye)
     96 
     97 # vi:et:ts=3:sw=3