Changeset 36055 in project


Ignore:
Timestamp:
08/06/18 19:51:21 (13 months ago)
Author:
Kooda
Message:

Port the sandbox egg to CHICKEN 5

Location:
release/5/sandbox
Files:
2 added
6 deleted
4 edited
4 copied

Legend:

Unmodified
Added
Removed
  • release/5/sandbox/tags/1.9/sandbox.egg

    r36054 r36055  
    1 ;;; sandbox.meta -*- Scheme -*-
     1;;; sandbox.egg -*- Scheme -*-
    22
    3 ((files "sandbox.setup" "sandbox.release-info" "sandbox.meta" "sandbox.scm" "debian/control" "debian/rules" "debian/copyright" "debian/changelog" "tests/run.scm")
    4  (category lang-exts)
     3((category lang-exts)
    54 (synopsis "A safe evaluation environment")
    65 (license "BSD")
    7  (doc-from-wiki)
    8  (needs matchable defstruct)
    9  (author "felix winkelmann"))
     6 (dependencies matchable defstruct)
     7 (author "felix winkelmann")
     8 (components (extension sandbox
     9               (csc-options "-O3" "-d1"))))
  • release/5/sandbox/tags/1.9/sandbox.scm

    r25271 r36055  
    4040 make-safe-environment)
    4141
    42 (import chicken scheme)
    43 (import-for-syntax matchable)
    44 
    45 (use defstruct)
     42(import scheme
     43        (chicken base)
     44        (chicken condition)
     45        (chicken fixnum)
     46        (chicken keyword)
     47        defstruct)
     48
     49(import-for-syntax (chicken platform) matchable)
    4650
    4751
     
    5458
    5559(define-syntax alloc/slot
     60  (er-macro-transformer
    5661  (lambda (e r c)
    5762    (let ([n (cadr e)]
    58           [i64 (##sys#fudge 3)])
     63          [i64 (feature? #:64bit)])
    5964         (if i64
    6065        `(,(r '*) ,n 8)
    61         `(,(r '*) ,n 4) ) ) ) )
     66        `(,(r '*) ,n 4) ) ) ) ) )
    6267
    6368(define-syntax alloc/pair
     69  (er-macro-transformer
    6470  (lambda (e r c)
    6571        (let ([n (cadr e)]
    66               [i64 (##sys#fudge 3)])
     72              [i64 (feature? #:64bit)])
    6773          (if i64
    6874              `(,(r '*) ,n 16)
    69               `(,(r '*) ,n 8) ) ) ) )
     75              `(,(r '*) ,n 8) ) ) ) ) )
    7076
    7177(define-constant fuel/lambda 1)
     
    509515(safe-environment-table-set!
    510516 default-safe-environment
    511  (map (lambda (s) (cons s (##sys#slot s 0)))
     517 (map (lambda (s) (cons s (##sys#slot (symbol-append 'scheme# s) 0)))
    512518      '(not boolean? eq? eqv? equal? pair? car cdr caar cadr cdar cddr caaar caadr cadar caddr cdaar
    513519            cdadr cddar cdddr caaaar caaadr caadar caaddr cadaar cadadr cadddr cdaaar cdaadr cdadar cdaddr
     
    534540
    535541(define-syntax defp
     542  (er-macro-transformer
    536543  (lambda (e r c)
    537544    (let ((args (cdr e)))
     
    539546      [((name . llist) . body) `(,(r 'primitive-set!) ',name (,(r 'lambda) ,llist ,@body))]
    540547      [(name val) `(,(r 'primitive-set!) ',name ,val)]
    541       [(name) `(,(r 'primitive-set!) ',name ,name)] ) ) ) )
     548      [(name) `(,(r 'primitive-set!) ',name ,name)] ) ) ) ) )
    542549
    543550(define (check-plist x loc)
     
    787794
    788795(define-syntax defm
     796  (er-macro-transformer
    789797  (lambda (e r c)
    790798    (let ((head (cadr e))
     
    796804         (let ([var (gensym)])
    797805           `(,(r 'lambda) (,var)
    798               (,(r 'apply) (,(r 'lambda) ,(cdr head) ,@body) ,var) ) ) ) ) ) ) )
     806              (,(r 'apply) (,(r 'lambda) ,(cdr head) ,@body) ,var) ) ) ) ) ) ) ) )
    799807
    800808(defm (define head . body)
  • release/5/sandbox/tags/1.9/tests/run.scm

    r25271 r36055  
    1 (use sandbox)
     1(import (chicken condition) sandbox)
    22
    33(define-syntax assert-error
  • release/5/sandbox/trunk/sandbox.egg

    r36054 r36055  
    1 ;;; sandbox.meta -*- Scheme -*-
     1;;; sandbox.egg -*- Scheme -*-
    22
    3 ((files "sandbox.setup" "sandbox.release-info" "sandbox.meta" "sandbox.scm" "debian/control" "debian/rules" "debian/copyright" "debian/changelog" "tests/run.scm")
    4  (category lang-exts)
     3((category lang-exts)
    54 (synopsis "A safe evaluation environment")
    65 (license "BSD")
    7  (doc-from-wiki)
    8  (needs matchable defstruct)
    9  (author "felix winkelmann"))
     6 (dependencies matchable defstruct)
     7 (author "felix winkelmann")
     8 (components (extension sandbox
     9               (csc-options "-O3" "-d1"))))
  • release/5/sandbox/trunk/sandbox.scm

    r25271 r36055  
    4040 make-safe-environment)
    4141
    42 (import chicken scheme)
    43 (import-for-syntax matchable)
    44 
    45 (use defstruct)
     42(import scheme
     43        (chicken base)
     44        (chicken condition)
     45        (chicken fixnum)
     46        (chicken keyword)
     47        defstruct)
     48
     49(import-for-syntax (chicken platform) matchable)
    4650
    4751
     
    5458
    5559(define-syntax alloc/slot
     60  (er-macro-transformer
    5661  (lambda (e r c)
    5762    (let ([n (cadr e)]
    58           [i64 (##sys#fudge 3)])
     63          [i64 (feature? #:64bit)])
    5964         (if i64
    6065        `(,(r '*) ,n 8)
    61         `(,(r '*) ,n 4) ) ) ) )
     66        `(,(r '*) ,n 4) ) ) ) ) )
    6267
    6368(define-syntax alloc/pair
     69  (er-macro-transformer
    6470  (lambda (e r c)
    6571        (let ([n (cadr e)]
    66               [i64 (##sys#fudge 3)])
     72              [i64 (feature? #:64bit)])
    6773          (if i64
    6874              `(,(r '*) ,n 16)
    69               `(,(r '*) ,n 8) ) ) ) )
     75              `(,(r '*) ,n 8) ) ) ) ) )
    7076
    7177(define-constant fuel/lambda 1)
     
    509515(safe-environment-table-set!
    510516 default-safe-environment
    511  (map (lambda (s) (cons s (##sys#slot s 0)))
     517 (map (lambda (s) (cons s (##sys#slot (symbol-append 'scheme# s) 0)))
    512518      '(not boolean? eq? eqv? equal? pair? car cdr caar cadr cdar cddr caaar caadr cadar caddr cdaar
    513519            cdadr cddar cdddr caaaar caaadr caadar caaddr cadaar cadadr cadddr cdaaar cdaadr cdadar cdaddr
     
    534540
    535541(define-syntax defp
     542  (er-macro-transformer
    536543  (lambda (e r c)
    537544    (let ((args (cdr e)))
     
    539546      [((name . llist) . body) `(,(r 'primitive-set!) ',name (,(r 'lambda) ,llist ,@body))]
    540547      [(name val) `(,(r 'primitive-set!) ',name ,val)]
    541       [(name) `(,(r 'primitive-set!) ',name ,name)] ) ) ) )
     548      [(name) `(,(r 'primitive-set!) ',name ,name)] ) ) ) ) )
    542549
    543550(define (check-plist x loc)
     
    787794
    788795(define-syntax defm
     796  (er-macro-transformer
    789797  (lambda (e r c)
    790798    (let ((head (cadr e))
     
    796804         (let ([var (gensym)])
    797805           `(,(r 'lambda) (,var)
    798               (,(r 'apply) (,(r 'lambda) ,(cdr head) ,@body) ,var) ) ) ) ) ) ) )
     806              (,(r 'apply) (,(r 'lambda) ,(cdr head) ,@body) ,var) ) ) ) ) ) ) ) )
    799807
    800808(defm (define head . body)
  • release/5/sandbox/trunk/tests/run.scm

    r25271 r36055  
    1 (use sandbox)
     1(import (chicken condition) sandbox)
    22
    33(define-syntax assert-error
Note: See TracChangeset for help on using the changeset viewer.