use define-unsafer for ffi/objc; fix more teachpack doc latex-output problems
svn: r13008
This commit is contained in:
parent
dc4aac224d
commit
c2857c1b7c
|
@ -3,7 +3,7 @@
|
||||||
scribble/eval
|
scribble/eval
|
||||||
(for-label scheme/base
|
(for-label scheme/base
|
||||||
scheme/foreign
|
scheme/foreign
|
||||||
ffi/objc))
|
"private/objc-doc-unsafe.ss"))
|
||||||
|
|
||||||
@(define objc-eval (make-base-eval))
|
@(define objc-eval (make-base-eval))
|
||||||
@(interaction-eval #:eval objc-eval (define-struct cpointer:id ()))
|
@(interaction-eval #:eval objc-eval (define-struct cpointer:id ()))
|
||||||
|
@ -13,7 +13,9 @@
|
||||||
|
|
||||||
@title{@bold{Objective-C} FFI}
|
@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
|
@schememodname[scheme/foreign] to support interaction with
|
||||||
@link["http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/"]{Objective-C}.}
|
@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
|
argument and result types must be declared in terms of FFI C types
|
||||||
(@seeCtype).
|
(@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[]
|
@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}
|
@section{FFI Types and Constants}
|
||||||
|
|
||||||
@defthing[_id ctype?]{
|
@defthing[_id ctype?]{
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
(define-syntax-rule (define-objc id type)
|
(define-syntax-rule (define-objc id type)
|
||||||
(begin
|
(begin
|
||||||
(provide id)
|
(provide* (unsafe id))
|
||||||
(define-objc/private id id type)))
|
(define-objc/private id id type)))
|
||||||
|
|
||||||
;; ----------------------------------------
|
;; ----------------------------------------
|
||||||
|
@ -86,16 +86,16 @@
|
||||||
(define msgSends (make-hash))
|
(define msgSends (make-hash))
|
||||||
(define (objc_msgSend/typed types)
|
(define (objc_msgSend/typed types)
|
||||||
(lookup-send types msgSends objc_msgSend objc_msgSend_fpret _id))
|
(lookup-send types msgSends objc_msgSend objc_msgSend_fpret _id))
|
||||||
(provide objc_msgSend/typed)
|
(provide* (unsafe objc_msgSend/typed))
|
||||||
|
|
||||||
(define msgSendSupers (make-hash))
|
(define msgSendSupers (make-hash))
|
||||||
(define (objc_msgSendSuper/typed types)
|
(define (objc_msgSendSuper/typed types)
|
||||||
(lookup-send types msgSendSupers objc_msgSendSuper objc_msgSendSuper_fpret _pointer))
|
(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)
|
(define-syntax (import-class stx)
|
||||||
(syntax-case stx ()
|
(syntax-case stx ()
|
||||||
[(_ id)
|
[(_ id)
|
||||||
|
@ -107,7 +107,7 @@
|
||||||
;; ----------------------------------------
|
;; ----------------------------------------
|
||||||
;; iget-value and set-ivar! work only with fields that contain Scheme values
|
;; 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)
|
(define-for-syntax (check-ivar ivar stx)
|
||||||
(unless (identifier? ivar)
|
(unless (identifier? ivar)
|
||||||
|
@ -161,7 +161,7 @@
|
||||||
(hash-set! method-sels sym id)
|
(hash-set! method-sels sym id)
|
||||||
id)))
|
id)))
|
||||||
|
|
||||||
(provide selector)
|
(provide* (unsafe selector))
|
||||||
(define-syntax (selector stx)
|
(define-syntax (selector stx)
|
||||||
(syntax-case stx ()
|
(syntax-case stx ()
|
||||||
[(_ id)
|
[(_ id)
|
||||||
|
@ -256,7 +256,7 @@
|
||||||
arg)))
|
arg)))
|
||||||
(loop (cdr rest))))))))
|
(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)
|
(define-for-syntax (build-send stx result-type send/typed send-args l-stx)
|
||||||
(let ([l (syntax->list l-stx)])
|
(let ([l (syntax->list l-stx)])
|
||||||
(with-syntax ([((tag type arg) ...) (parse-arg-list l stx #f)]
|
(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)
|
(define-syntax (define-objc-class stx)
|
||||||
(syntax-case stx ()
|
(syntax-case stx ()
|
||||||
|
@ -549,3 +549,8 @@
|
||||||
#'objc_msgSendSuper/typed
|
#'objc_msgSendSuper/typed
|
||||||
#'((make-objc_super self super-class))
|
#'((make-objc_super self super-class))
|
||||||
#'(method/arg ...))]))
|
#'(method/arg ...))]))
|
||||||
|
|
||||||
|
;; --------------------------------------------------
|
||||||
|
|
||||||
|
(define-unsafer objc-unsafe!)
|
||||||
|
|
||||||
|
|
10
collects/ffi/private/objc-doc-unsafe.ss
Normal file
10
collects/ffi/private/objc-doc-unsafe.ss
Normal file
|
@ -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))
|
|
@ -4,6 +4,7 @@
|
||||||
mzlib/class
|
mzlib/class
|
||||||
scheme/runtime-path
|
scheme/runtime-path
|
||||||
scheme/port
|
scheme/port
|
||||||
|
scheme/path
|
||||||
scheme/string
|
scheme/string
|
||||||
setup/main-collects)
|
setup/main-collects)
|
||||||
(provide render-mixin)
|
(provide render-mixin)
|
||||||
|
@ -18,6 +19,11 @@
|
||||||
|
|
||||||
(define-runtime-path scribble-tex "scribble.tex")
|
(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 %)
|
(define (render-mixin %)
|
||||||
(class %
|
(class %
|
||||||
(init-field [style-file #f]
|
(init-field [style-file #f]
|
||||||
|
@ -194,7 +200,7 @@
|
||||||
(void)
|
(void)
|
||||||
(let ([fn (install-file
|
(let ([fn (install-file
|
||||||
(main-collects-relative->path
|
(main-collects-relative->path
|
||||||
(image-file-path style)))])
|
(gif-to-png (image-file-path style))))])
|
||||||
(printf "\\includegraphics[scale=~a]{~a}"
|
(printf "\\includegraphics[scale=~a]{~a}"
|
||||||
(image-file-scale style) fn)))]
|
(image-file-scale style) fn)))]
|
||||||
[else (super render-element e part ri)])))
|
[else (super render-element e part ri)])))
|
||||||
|
|
BIN
collects/teachpack/balls.png
Normal file
BIN
collects/teachpack/balls.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
|
@ -10,7 +10,7 @@ data 'DITL' (129) {
|
||||||
$"0081 0000 0000 0018 008F 0048 0170 8844" /* .<2E>.......<EFBFBD>.H.pˆD */
|
$"0081 0000 0000 0018 008F 0048 0170 8844" /* .<2E>.......<EFBFBD>.H.pˆD */
|
||||||
$"4372 6561 7465 6420 7769 7468 2050 4C54" /* Created with PLT */
|
$"4372 6561 7465 6420 7769 7468 2050 4C54" /* Created with PLT */
|
||||||
$"2053 6368 656D 650D A920 3230 3034 2D32" /* Scheme.© 2004-2 */
|
$"2053 6368 656D 650D A920 3230 3034 2D32" /* Scheme.© 2004-2 */
|
||||||
$"3030 3720 504C 5420 5363 6865 6D65 2049" /* 007 PLT Scheme I */
|
$"3030 3920 504C 5420 5363 6865 6D65 2049" /* 009 PLT Scheme I */
|
||||||
$"6E63 2E20 0DA9 2031 3939 352D 3230 3033" /* nc. .© 1995-2003 */
|
$"6E63 2E20 0DA9 2031 3939 352D 3230 3033" /* nc. .© 1995-2003 */
|
||||||
$"2050 4C54 0000 0000 004D 008F 0089 018F" /* PLT.....M.<EFBFBD>.‰.<EFBFBD> */
|
$"2050 4C54 0000 0000 004D 008F 0089 018F" /* PLT.....M.<EFBFBD>.‰.<EFBFBD> */
|
||||||
$"884E 466F 7220 7570 2D74 6F2D 6461 7465" /* ˆNFor up-to-date */
|
$"884E 466F 7220 7570 2D74 6F2D 6461 7465" /* ˆNFor up-to-date */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user