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
|
||||
(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?]{
|
||||
|
|
|
@ -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!)
|
||||
|
||||
|
|
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
|
||||
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)])))
|
||||
|
|
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 */
|
||||
$"4372 6561 7465 6420 7769 7468 2050 4C54" /* Created with PLT */
|
||||
$"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 */
|
||||
$"2050 4C54 0000 0000 004D 008F 0089 018F" /* PLT.....M.<EFBFBD>.‰.<EFBFBD> */
|
||||
$"884E 466F 7220 7570 2D74 6F2D 6461 7465" /* ˆNFor up-to-date */
|
||||
|
|
Loading…
Reference in New Issue
Block a user