trying to teach the make system about javascript-implemented modules.
This commit is contained in:
parent
51490ec16b
commit
f79886060c
7
NOTES
7
NOTES
|
@ -738,4 +738,9 @@ I should add the functions:
|
|||
get-viewport-width
|
||||
get-viewport-height
|
||||
|
||||
Other notes from Shriram: too slow, inconsistent positioning from jsworld.
|
||||
Other notes from Shriram: too slow, inconsistent positioning from jsworld.
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Added base as the default planet language.
|
4
README
4
README
|
@ -17,8 +17,6 @@ amount of time.
|
|||
|
||||
Example usage
|
||||
|
||||
[TODO: make this a reality... The lang line would preferably be
|
||||
#lang planet dyoo/whalesong]
|
||||
|
||||
|
||||
Create a simple, standalong executable of your program. At the
|
||||
|
@ -27,7 +25,7 @@ moment, the program must be written in the base language of whalesong.
|
|||
from compiling, and we'll be working to remove this restriction.)
|
||||
|
||||
$ cat hello.rkt
|
||||
#lang s-exp "lang/base.rkt"
|
||||
#lang planet dyoo/whalesong
|
||||
(display "hello world")
|
||||
(newline)
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
"../make/make.rkt"
|
||||
"../make/make-structs.rkt"
|
||||
"../parameters.rkt"
|
||||
"../lang/js/query.rkt"
|
||||
(planet dyoo/closure-compile:1:1)
|
||||
(prefix-in runtime: "get-runtime.rkt")
|
||||
(prefix-in racket: racket/base))
|
||||
|
@ -38,6 +39,19 @@
|
|||
|
||||
|
||||
|
||||
;; source-is-javascript-module?: Source -> (or Source #f)
|
||||
(define (source-is-javascript-module? src)
|
||||
(cond
|
||||
[(StatementsSource? src)
|
||||
src]
|
||||
[(MainModuleSource? src)
|
||||
src]
|
||||
[(ModuleSource? src)
|
||||
src]
|
||||
[(SexpSource? src)
|
||||
src]
|
||||
[(UninterpretedSource? src)
|
||||
src]))
|
||||
|
||||
|
||||
|
||||
|
@ -59,15 +73,32 @@
|
|||
;; wrap-source: source -> source
|
||||
(define (wrap-source src)
|
||||
(printf "adding ~s\n" src)
|
||||
src)
|
||||
(cond
|
||||
[(source-is-javascript-module? src)
|
||||
=>
|
||||
(lambda (wrapped-src)
|
||||
wrapped-src)]
|
||||
[else
|
||||
src]))
|
||||
|
||||
|
||||
(define (on-visit-src src ast stmts)
|
||||
(assemble/write-invoke stmts op)
|
||||
(fprintf op "(MACHINE, function() { "))
|
||||
(cond
|
||||
[(UninterpretedSource? src)
|
||||
;; FIXME
|
||||
(void)]
|
||||
[else
|
||||
(assemble/write-invoke stmts op)
|
||||
(fprintf op "(MACHINE, function() { ")]))
|
||||
|
||||
|
||||
(define (after-visit-src src ast stmts)
|
||||
(fprintf op " }, FAIL, PARAMS);"))
|
||||
(cond
|
||||
[(UninterpretedSource? src)
|
||||
;; FIXME
|
||||
(void)]
|
||||
[else
|
||||
(fprintf op " }, FAIL, PARAMS);")]))
|
||||
|
||||
|
||||
(define (on-last-src)
|
||||
|
|
|
@ -85,6 +85,7 @@
|
|||
[program (second javascript-compiler+program)])
|
||||
|
||||
(with-handlers ([exn:fail? (lambda (exn)
|
||||
(displayln exn)
|
||||
(let ([sentinel
|
||||
(format
|
||||
#<<EOF
|
||||
|
|
Loading…
Reference in New Issue
Block a user