From f56253f2298805b5b8c069124e20f551e8d0bc09 Mon Sep 17 00:00:00 2001 From: Danny Yoo Date: Thu, 26 May 2011 19:18:21 -0400 Subject: [PATCH] moving files around some more --- bootstrapped-primitives.rkt | 4 +-- js-assembler/package.rkt | 32 ++++++++++++------- .../quote-cdata.rkt | 0 parser/path-rewriter.rkt | 2 +- .../where-is-collects.rkt | 0 5 files changed, 24 insertions(+), 14 deletions(-) rename quote-cdata.rkt => js-assembler/quote-cdata.rkt (100%) rename where-is-collects.rkt => parser/where-is-collects.rkt (100%) diff --git a/bootstrapped-primitives.rkt b/bootstrapped-primitives.rkt index 700b512..a1b1020 100644 --- a/bootstrapped-primitives.rkt +++ b/bootstrapped-primitives.rkt @@ -3,8 +3,8 @@ "lexical-structs.rkt" "il-structs.rkt" "compiler.rkt" - "compiler-structs.rkt" - "where-is-collects.rkt") + "compiler-structs.rkt") + (require/typed "parameters.rkt" (current-defined-name (Parameterof (U Symbol LamPositionalName)))) diff --git a/js-assembler/package.rkt b/js-assembler/package.rkt index a19875c..a629ed5 100644 --- a/js-assembler/package.rkt +++ b/js-assembler/package.rkt @@ -1,7 +1,7 @@ #lang racket/base (require "assemble.rkt" - "../quote-cdata.rkt" + "quote-cdata.rkt" "../make.rkt" "../make-structs.rkt" "get-runtime.rkt" @@ -18,9 +18,6 @@ - - - (define (package-anonymous source-code #:should-follow? should-follow? #:output-port op) @@ -33,10 +30,15 @@ -;; package: s-expression (path -> boolean) output-port -> void +;; package: Source (path -> boolean) output-port -> void ;; Compile package for the given source program. should-follow? ;; indicates whether we should continue following module paths. +;; +;; The generated output defines a function called 'invoke' with +;; four arguments (MACHINE, SUCCESS, FAIL, PARAMS). When called, it'll +;; execute the code to either run standalone expressions or +;; load in modules. (define (package source-code #:should-follow? should-follow? #:output-port op) @@ -62,7 +64,7 @@ (fprintf op "var invoke = (function(MACHINE, SUCCESS, FAIL, PARAMS) {") (make (cons only-bootstrapped-code (list (make-MainModuleSource source-code))) - packaging-configuration) + packaging-configuration) (fprintf op "});\n")) @@ -99,18 +101,26 @@ var invokeMainModule = function() { MACHINE.modules['*main*'].invoke( MACHINE, function() { - console.log("done with main module invokation"); // On main module invokation success }, function(MACHINE, e) { - console.log(e.stack); // On main module invokation failure + if (console && console.log) { + console.log(e.stack || e); + } })}, - function() {}, + function() { + // On module loading failure + if (console && console.log) { + console.log(e.stack || e); + } + }, { currentDisplayer : function(v) { - document.body.appendChild(document.createTextNode(String(v))); - document.body.appendChild(document.createElement("br")); + document.body.appendChild( + document.createTextNode(String(v))); + document.body.appendChild( + document.createElement("br")); } }); }; diff --git a/quote-cdata.rkt b/js-assembler/quote-cdata.rkt similarity index 100% rename from quote-cdata.rkt rename to js-assembler/quote-cdata.rkt diff --git a/parser/path-rewriter.rkt b/parser/path-rewriter.rkt index 7578547..4db0038 100644 --- a/parser/path-rewriter.rkt +++ b/parser/path-rewriter.rkt @@ -1,7 +1,7 @@ #lang racket/base (require "../parameters.rkt" - "../where-is-collects.rkt" + "where-is-collects.rkt" racket/path racket/contract racket/list diff --git a/where-is-collects.rkt b/parser/where-is-collects.rkt similarity index 100% rename from where-is-collects.rkt rename to parser/where-is-collects.rkt