added hack to specialize certain resources

This commit is contained in:
Danny Yoo 2011-09-14 15:52:28 -04:00
parent ea793a1009
commit 27552665e1
6 changed files with 34 additions and 11 deletions

View File

@ -4,10 +4,22 @@
(planet dyoo/whalesong/image))
(define-resource whale-resource "images/humpback.jpg")
(define-resource self-resource "using-resources.rkt")
(define whale-image
(image-url
(resource->url whale-resource)))
whale-image
whale-image
(list whale-image whale-image)
(resource? whale-image)
(image? whale-image)
(list whale-resource whale-resource)
(resource? whale-resource)
(image? whale-resource)
(list self-resource self-resource)
(resource? self-resource)
(image? self-resource)

View File

@ -70,12 +70,6 @@ var isPointsCount = function(x) {
var imageSignature = { updatePinhole : function() {},
getHeight : function() {},
getWidth: function() {},
getBaseline : function() {},
render: function() {} };
// Produces true if thing is an image-like object.

View File

@ -11,6 +11,7 @@
(provide define-resource)
(require "structs.rkt")
(require "specialize/impl.rkt")
;; file-resource:
@ -45,4 +46,5 @@
(record-resource resolved-module-path normal-path munged-path)))
;; Run time code
(define name (resource normal-path munged-path content))))))]))
(define name (specialize!
(resource normal-path munged-path content)))))))]))

View File

@ -1,6 +1,8 @@
#lang s-exp "../lang/kernel.rkt"
(require "compile-time.rkt"
"runtime.rkt")
"runtime.rkt"
"structs.rkt")
(provide (all-from-out "compile-time.rkt"
"runtime.rkt"))
"runtime.rkt")
resource?)

View File

@ -0,0 +1,8 @@
#lang s-exp "../../lang/js/js.rkt"
(require "../structs.rkt")
(declare-implementation
#:racket "racket-impl.rkt"
#:javascript ("js-impl.js")
#:provided-values (specialize!))

View File

@ -0,0 +1,5 @@
#lang racket/base
(provide specialize!)
(define (specialize! resource)
resource)