~williewillus/r16

32da8256fb48f4401454bff92bf7d7efb7da3d7e — Vincent Lee 4 months ago 1cefcd4
Organize imports
8 files changed, 65 insertions(+), 26 deletions(-)

M backend.rkt
M common.rkt
M config.rkt
M evaluator.rkt
M interface.rkt
M main.rkt
M trick-db.rkt
M trick.rkt
M backend.rkt => backend.rkt +14 -6
@@ 1,9 1,17 @@
#lang racket

(require "interface.rkt" "common.rkt"
         (prefix-in ev: "evaluator.rkt")
         (prefix-in db: "trick-db.rkt")
         threading)
#lang racket/base

(require
 racket/class
 racket/contract
 (only-in racket/format ~a)
 (only-in racket/function const identity thunk)
 (only-in racket/sequence sequence->list)
 (only-in racket/string string-join)
 threading
 "common.rkt"
 (prefix-in ev: "evaluator.rkt")
 "interface.rkt"
 (prefix-in db: "trick-db.rkt"))

(provide r16%)


M common.rkt => common.rkt +1 -1
@@ 1,4 1,4 @@
#lang racket
#lang racket/base

(provide (struct-out trick) json->trick trick->json)


M config.rkt => config.rkt +2 -1
@@ 1,5 1,6 @@
#lang racket
#lang racket/base

(require racket/contract)
(provide config/c check-config)

(define-syntax-rule (config/c [key vpred] ...)

M evaluator.rkt => evaluator.rkt +16 -4
@@ 1,6 1,15 @@
#lang racket

(require racket/contract racket/sandbox syntax/strip-context threading)
#lang racket/base

(require
 racket/contract
 (only-in racket/format ~a)
 (only-in racket/function thunk)
 (only-in racket/list filter-not)
 racket/sandbox
 (only-in racket/sequence sequence->list)
 (only-in racket/string non-empty-string?)
 (only-in syntax/strip-context replace-context)
 threading)

(provide
 definitions?


@@ 181,7 190,10 @@
  (run-result stdout (and (non-empty-string? stderr) stderr) results))

(module+ test
  (require rackunit)
  (require
   (only-in racket/class is-a?)
   (only-in racket/format ~s)
   rackunit)

  (define empty-defs '(()))
  (define (any? _ignored) #t)

M interface.rkt => interface.rkt +6 -4
@@ 1,8 1,10 @@
#lang racket
#lang racket/base

(require (only-in "evaluator.rkt" definitions? run-result?)
         threading
         "common.rkt")
(require
 racket/class
 racket/contract
 (only-in "evaluator.rkt" definitions? run-result?)
 "common.rkt")

(provide r16-backend? r16-frontend?
         r16-backend<%> r16-frontend<%>

M main.rkt => main.rkt +15 -7
@@ 1,12 1,20 @@
#!/usr/bin/env racket
#lang racket
#lang racket/base

(require json threading
         "common.rkt"
         "backend.rkt"
         "interface.rkt"
         "config.rkt"
         (prefix-in db: "trick-db.rkt"))
(require
 (only-in racket/class new send)
 (only-in racket/contract -> contract or/c)
 (only-in racket/format ~a)
 (only-in racket/function const thunk)
 racket/match
 (only-in racket/port call-with-input-string with-input-from-string)
 json
 threading
 "backend.rkt"
 "common.rkt"
 "config.rkt"
 "interface.rkt"
 (prefix-in db: "trick-db.rkt"))

(define (readable? x)
  (and (string? x)

M trick-db.rkt => trick-db.rkt +10 -2
@@ 1,8 1,13 @@
#lang racket
#lang racket/base

(require
 json
 racket/contract
 (only-in racket/file call-with-atomic-output-file)
 (only-in racket/format ~a)
 (only-in racket/function const thunk)
 (only-in racket/list last)
 (only-in racket/string string-suffix? string-trim)
 (only-in racket/symbol symbol->immutable-string)
 "log.rkt")



@@ 136,7 141,10 @@
           #t))))

(module* test #f
  (require rackunit)
  (require (only-in racket/file
                    delete-directory/files
                    make-temporary-file)
           rackunit)

  (struct
    fake-trick

M trick.rkt => trick.rkt +1 -1
@@ 1,4 1,4 @@
#lang racket
#lang racket/base

;; #lang r16/trick <trick>