Commit Graph

176 Commits

Author SHA1 Message Date
Ryan Culpepper
a5c415d15a change allocator wrapper to ignore #f results
Supports foreign functions that either allocate or return NULL
(translated to #f).
2012-11-21 12:56:30 -05:00
Matthew Flatt
4ca7e6bc77 ffi/unsafe: fixes related to `define-cstruct' and properties
Fix the binding context for property and property-value
expressions. Propagate wrappers (and therefore properties)
to cstruct subtypes.
2012-11-11 09:38:15 -07:00
Eli Barzilay
672910f27b Lots of bad TAB eliminations.
I started from tabs that are not on the beginning of lines, and in
several places I did further cleanings.

If you're worried about knowing who wrote some code, for example, if you
get to this commit in "git blame", then note that you can use the "-w"
flag in many git commands to ignore whitespaces.  For example, to see
per-line authors, use "git blame -w <file>".  Another example: to see
the (*much* smaller) non-whitespace changes in this (or any other)
commit, use "git log -p -w -1 <sha1>".
2012-11-07 11:22:20 -05:00
Matthew Flatt
9708a01a0a ffi/unsafe: defend against some finalization bugs
Turn use of a finalized ffi callout into a reported error,
instead of a crash. Clarify the existence of the finalizer
in the docs. Fix error logging of the finalizer thread.

Merge to v5.3.1
2012-10-21 08:11:45 -06:00
Matthew Flatt
fcfff27c31 ffi/com: implement vardesc-based dispatch
The `title' property of IE9 triggers the new code, which wasn't
implemented before because I didn't have an example.
2012-10-05 12:26:14 -06:00
Matthew Flatt
7c5174d54e ffi/com: faster when calling methods on many objects of same type
Move the method-type cache to the type-info object, instead of
the instance.
2012-10-05 11:05:42 -06:00
Matthew Flatt
5c2b00ea78 ffi/com: try to reduce overhead on `com-invoke'
Also, fix a potential memory bug: the exception-record value
passed to Invoke() as synthesized by `_ptr' was GCable and
movable.
2012-10-05 11:05:41 -06:00
Matthew Flatt
8bd5dbf7cc ffi/unsafe: change `cast' to avoid pitfalls for you
The old `cast' didn't work right for a mismatch between
a pointer GCableness and the source or target types, and
it didn't work right for an GCable pointer with a non-zero
offset. While those pitfalls were documented, the first
of them definitely has been a source of bugs in code that
I wrote.

Also added `cpointer-gcable?'
2012-09-04 15:28:18 -06:00
Matthew Flatt
3f825b8d20 ffi/com: fix reference counting
Don't AddRef() on "in" arguments, do AddRef() on "out"
or "in-out" arguments.
2012-09-01 09:48:35 -06:00
Matthew Flatt
f1ff9c6059 ffi/com: fix unmarshal of by-ref results 2012-09-01 09:48:35 -06:00
Matthew Flatt
eb7fd51d02 ffi/com: add `any ...' support for method arguments
Also allow `?' for the length of an array and suport VT_SAFEARRAY
arguments (mostly the same as VT_ARRAY).
2012-09-01 09:48:35 -06:00
Matthew Flatt
e407303c5e ffi/com: add missing export 2012-09-01 09:48:34 -06:00
Matthew Flatt
3a2b562ff4 remove debugging printf 2012-09-01 09:48:34 -06:00
Matthew Flatt
d11e58b639 ffi/unsafe/atomic: add `in-atomic-mode?'
The new function can be useful for debugging, at least.
2012-08-31 07:33:08 -06:00
Matthew Flatt
d953bc27ba fix `ffi/unsafe/nsalloc'
Using `call-as-atomic' isn't right, because that allows an escape
via `call-as-nonatomic'. Assuming that `call-as-nonatomic' isn't
used, it seems like `call-as-atomic' should be ok, anyway, but
somehow its leads to unbalanced `end-atomic' calls.
2012-08-28 18:45:55 -06:00
Matthew Flatt
85b99de7b1 ffi/unsafe/objc: more support for loading in unsupported contexts 2012-08-27 19:47:44 -06:00
Matthew Flatt
7b49ad088a ffi/unsafe/objc: `objc_lookUpClass' produces #f when unavailable
This change allows `ffi/unsafe/nsstring', for example, to at least load
on all platforms.
2012-08-27 10:29:55 -06:00
Matthew Flatt
a523270025 ffi/com: repair for DCOM instance creation 2012-08-27 08:57:01 -06:00
Matthew Flatt
088d1dadb4 add ffi/unsafe/nsalloc' and ffi/unsafe/nsstring' 2012-08-24 15:48:58 -06:00
Matthew Flatt
0452bd791d bytecode optimizer improvement
Treat unsafe functional operations (which never raise an
exception) as omitable, which means that simple `let-values'
combinations can be split into `let' bindings, etc.
2012-08-16 13:11:41 -06:00
Matthew Flatt
bb3545ddf7 ffi/unsafe/custodian: #:atexit?' -> #:at-exit?' 2012-08-12 20:25:47 -06:00
Matthew Flatt
4e5b46405d ffi/com: release COM objects at exit
Uses the new `ffi/unsafe/custodian' library.
2012-08-12 20:17:29 -06:00
Matthew Flatt
42ef79c2ad add `ffi/unsafe/custodian' 2012-08-12 20:17:29 -06:00
Matthew Flatt
1d8791c7c4 ffi/unsafe: show errors from a finalizer
Previously, an error from a finalizer would disappear and kill
of the finalizer thread. Now the error is logged and the thread
continues.
2012-08-03 13:43:23 -06:00
Matthew Flatt
66eaa191e5 ffi/com: fix interaction with `racket/gui'
... and other things that use the Windows message
queue by not providing GCable arguments to
IDispatch::Invoke().

Merge to v5.3
2012-08-02 19:20:36 -06:00
Matthew Flatt
38ce4997a9 ffi/com: fix potential interaction of finalization and custodians
Includes new `#:manage?' optional argument to `make-com-object'
and better management of internally created objects.

Merge to v5.3
2012-08-02 16:29:03 -06:00
Matthew Flatt
572252daec ffi/com: thread safety
Protect internal data structures via atomic mode.

Merge to v5.3
2012-08-02 16:29:02 -06:00
Matthew Flatt
286efface0 ffi/com: adjust order in object release
Release type descriptors before type infos, and release type
infos before objects. (This reordering shouldn't matter if
referencing counting does its usual job, but maybe it's better
to use the obvious order.)

Merge to v5.3
2012-08-02 08:01:00 -06:00
Matthew Flatt
38167dd4fa ffi/com: remove stray quote
Merge to v5.3
2012-08-01 09:34:11 -06:00
Matthew Flatt
9b1db14328 ffi/com: fix clean-up of type descriptors
Merge to v5.3
2012-07-29 09:46:30 -06:00
Eli Barzilay
29d6d377fc Modernize (& racketize) ffi/examples. 2012-07-27 10:31:26 -04:00
Matthew Flatt
cd90510f07 ffi/com: AddRef on IUnknown arguments to COM methods
Merge to v5.3
2012-07-23 14:35:27 -05:00
Matthew Flatt
94498465e6 ffi/com: fix another instance of the `cast' bug
Overlooked it during the previous repair; this repair merges
the two formerly broken sites.
2012-07-19 20:20:33 -05:00
Matthew Flatt
c86ee5b6e2 ffi/com: fix an internal cast
Merge to v5.3
2012-07-19 19:02:54 -06:00
Matthew Flatt
1e115e2963 ffi/com: repairs for '(box any) 2012-06-26 11:00:11 -06:00
Matthew Flatt
90b5aad56b ffi/com: fixes for IUnknown and enumeration values 2012-06-25 17:30:03 -06:00
Jay McCarthy
7f1d0a9e3b Fix now broken usage of regexp-replaces in ffi 2012-06-25 15:59:17 -06:00
Eli Barzilay
7ec9975736 Move regexp-replaces' from ffi/unsafe' to `racket/private/string'.
* The old function was removed completely, people will get it from
  `racket/base' anyway.

* I also removed its documentation.  I thought about leaving a note in,
  but if `define-ffi-definer' is the preferred style, then this should
  be done when there's a way to make `define-ffi-definer' use it.  (Eg,
  some new #:keyword that adds a way to change the defined name.)

* Note that the function is added to `racket/private/string' and not to
  `racket/string' because the latter deals only with strings, and the
  new function accepts byte strings too.  It might be better to start a
  new `racket/regexp' module for these functions.
2012-06-22 14:27:14 -04:00
Eli Barzilay
7d6e79023c Random pickiness.
Spaces at EOFs, indentation, etc.
2012-06-22 12:00:48 -04:00
Matthew Flatt
a04ba8aef3 ffi/com: allow a `com-object' as an 'iunknown argument 2012-06-22 09:47:59 +08:00
Matthew Flatt
1dc0072d03 further error message convention refinements
Add extra intitial-message lines, use "..." on a field name
to indicate that it could reasonably be hidden by default,
and refine some existing messages.
2012-06-22 09:47:59 +08:00
Matthew Flatt
fbb6a294f3 local-expand' allows a stop list to have only module*'
That is, when the sto plist contains only `module*', core
forms are not implicitly added to the stop list.
2012-06-08 16:08:55 +08:00
Matthew Flatt
a137459b65 more error-message conversions and repairs 2012-05-27 11:29:21 -06:00
Matthew Flatt
09cb2a348f ffi/com: add 'variant type description
Used to prevent extra array dimensions and instead construct nested
arrays.
2012-05-26 06:38:02 -06:00
Eli Barzilay
7f940de6f9 Fix `array-set!' for arrays of more than 2 dimensions.
Closes PR 12765.
2012-05-11 06:18:21 -04:00
Eli Barzilay
17090fca4f A bunch of fprintf' -> eprintf' conversions (and a few related things). 2012-05-06 12:06:00 -04:00
Matthew Flatt
ffea2b2c02 ffi/unsafe/com: infer 'any type for `com-omit' 2012-04-25 00:11:57 -06:00
Matthew Flatt
38e628be80 ffi/com: add support for type descriptions on values 2012-04-16 08:47:13 -06:00
Matthew Flatt
4179cbfa63 enforce ranges on all integer types
DO NOT merge to 5.3
2012-04-15 05:37:44 -06:00
Matthew Flatt
c695727aec ffi/unsafe/com: fix arrays of 'any 2012-04-11 19:12:32 -06:00