From c2857c1b7ce7cc1dde3cbfeb0e0175b422a2138c Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 5 Jan 2009 10:20:17 +0000 Subject: [PATCH] use define-unsafer for ffi/objc; fix more teachpack doc latex-output problems svn: r13008 --- collects/ffi/objc.scrbl | 21 +++++++++++++++++++-- collects/ffi/objc.ss | 21 +++++++++++++-------- collects/ffi/private/objc-doc-unsafe.ss | 10 ++++++++++ collects/scribble/latex-render.ss | 8 +++++++- collects/teachpack/balls.png | Bin 0 -> 1505 bytes src/mac/cw/MrEd.r | 2 +- 6 files changed, 50 insertions(+), 12 deletions(-) create mode 100644 collects/ffi/private/objc-doc-unsafe.ss create mode 100644 collects/teachpack/balls.png diff --git a/collects/ffi/objc.scrbl b/collects/ffi/objc.scrbl index 00f4985c85..e4564f6161 100644 --- a/collects/ffi/objc.scrbl +++ b/collects/ffi/objc.scrbl @@ -3,7 +3,7 @@ scribble/eval (for-label scheme/base scheme/foreign - ffi/objc)) + "private/objc-doc-unsafe.ss")) @(define objc-eval (make-base-eval)) @(interaction-eval #:eval objc-eval (define-struct cpointer:id ())) @@ -13,7 +13,9 @@ @title{@bold{Objective-C} FFI} -@defmodule[ffi/objc]{The @schememodname[ffi/objc] library builds on +@declare-exporting[ffi/private/objc-doc-unsafe #:use-sources (ffi/objc)] + +@defmodule*/no-declare[(ffi/objc)]{The @schememodname[ffi/objc] library builds on @schememodname[scheme/foreign] to support interaction with @link["http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/"]{Objective-C}.} @@ -26,8 +28,23 @@ relatively low-level compared to normal Scheme libraries, because argument and result types must be declared in terms of FFI C types (@seeCtype). +@bold{Important:} Most of the bindings documented here are available +only after an @scheme[(objc-unsafe!)] declaration in the importing +module. + @table-of-contents[] +@; ---------------------------------------------------------------------- + +@section{Using Unsafe Bindings} + +@defform[(objc-unsafe!)]{ + +Analogous to @scheme[(unsafe!)], makes unsafe bindings of +@schememodname[ffi/objc] available in the importing module.} + +@; ---------------------------------------------------------------------- + @section{FFI Types and Constants} @defthing[_id ctype?]{ diff --git a/collects/ffi/objc.ss b/collects/ffi/objc.ss index 8c9be4ccb9..0b89fb3eb9 100644 --- a/collects/ffi/objc.ss +++ b/collects/ffi/objc.ss @@ -15,7 +15,7 @@ (define-syntax-rule (define-objc id type) (begin - (provide id) + (provide* (unsafe id)) (define-objc/private id id type))) ;; ---------------------------------------- @@ -86,16 +86,16 @@ (define msgSends (make-hash)) (define (objc_msgSend/typed types) (lookup-send types msgSends objc_msgSend objc_msgSend_fpret _id)) -(provide objc_msgSend/typed) +(provide* (unsafe objc_msgSend/typed)) (define msgSendSupers (make-hash)) (define (objc_msgSendSuper/typed types) (lookup-send types msgSendSupers objc_msgSendSuper objc_msgSendSuper_fpret _pointer)) -(provide objc_msgSendSuper/typed) +(provide* (unsafe objc_msgSendSuper/typed)) ;; ---------------------------------------- -(provide import-class) +(provide* (unsafe import-class)) (define-syntax (import-class stx) (syntax-case stx () [(_ id) @@ -107,7 +107,7 @@ ;; ---------------------------------------- ;; iget-value and set-ivar! work only with fields that contain Scheme values -(provide get-ivar set-ivar!) +(provide* (unsafe get-ivar) (unsafe set-ivar!)) (define-for-syntax (check-ivar ivar stx) (unless (identifier? ivar) @@ -161,7 +161,7 @@ (hash-set! method-sels sym id) id))) -(provide selector) +(provide* (unsafe selector)) (define-syntax (selector stx) (syntax-case stx () [(_ id) @@ -256,7 +256,7 @@ arg))) (loop (cdr rest)))))))) -(provide tell tellv) +(provide* (unsafe tell) (unsafe tellv)) (define-for-syntax (build-send stx result-type send/typed send-args l-stx) (let ([l (syntax->list l-stx)]) (with-syntax ([((tag type arg) ...) (parse-arg-list l stx #f)] @@ -329,7 +329,7 @@ ;; ---------------------------------------- -(provide define-objc-class self super-tell) +(provide* (unsafe define-objc-class) self super-tell) (define-syntax (define-objc-class stx) (syntax-case stx () @@ -549,3 +549,8 @@ #'objc_msgSendSuper/typed #'((make-objc_super self super-class)) #'(method/arg ...))])) + +;; -------------------------------------------------- + +(define-unsafer objc-unsafe!) + diff --git a/collects/ffi/private/objc-doc-unsafe.ss b/collects/ffi/private/objc-doc-unsafe.ss new file mode 100644 index 0000000000..20ecc1eb89 --- /dev/null +++ b/collects/ffi/private/objc-doc-unsafe.ss @@ -0,0 +1,10 @@ +#lang scheme/base + +(require ffi/objc) + +(error 'objc-unsafe! "only `for-label' use in the documentation") + +(objc-unsafe!) + +(provide (protect-out (all-defined-out)) + (all-from-out ffi/objc)) diff --git a/collects/scribble/latex-render.ss b/collects/scribble/latex-render.ss index 5c88ec23e5..23b6c0e67e 100644 --- a/collects/scribble/latex-render.ss +++ b/collects/scribble/latex-render.ss @@ -4,6 +4,7 @@ mzlib/class scheme/runtime-path scheme/port + scheme/path scheme/string setup/main-collects) (provide render-mixin) @@ -18,6 +19,11 @@ (define-runtime-path scribble-tex "scribble.tex") +(define (gif-to-png p) + (if (equal? (filename-extension p) #"gif") + (path-replace-suffix p #".png") + p)) + (define (render-mixin %) (class % (init-field [style-file #f] @@ -194,7 +200,7 @@ (void) (let ([fn (install-file (main-collects-relative->path - (image-file-path style)))]) + (gif-to-png (image-file-path style))))]) (printf "\\includegraphics[scale=~a]{~a}" (image-file-scale style) fn)))] [else (super render-element e part ri)]))) diff --git a/collects/teachpack/balls.png b/collects/teachpack/balls.png new file mode 100644 index 0000000000000000000000000000000000000000..03ea3eb596e145ff37dbd99dba59d6753b2d30ba GIT binary patch literal 1505 zcmV<71s?i|P)?PNfdsLpiFU=KZR1(**b~;@ z8#(j$=FQCKZy#^hJ5(BtMq5fCQ&UqV*hRc8?C$Qyn>^sm69H|}6cLDy00|xaE8qe` zB0xgtK(iv19NJWkfdC1e1NF9);&vm)j(gJJJL} zj=D)xnn~U4Si9AsYj)~VPs*rU8}xhGFk8%fBQTbP?hVIj4+y=l>8YkaHDzU9<`dGR z9lEHStjemq(uDC#np`ov=IPOYs0npzgZ}qyxb|4?M4&Q`kL}`mvw+y)4x|QKU z7c_y4@Zuo;O--hs6w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