Commit Graph

42 Commits

Author SHA1 Message Date
Matthew Flatt
a137459b65 more error-message conversions and repairs 2012-05-27 11:29:21 -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
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
738cac3d24 generalize `malloc' to allow a 0-sized request
Past experience suggests that this is generally better than adding
`zero?' tests at various places that might otherwise call `malloc'.
2012-03-29 14:55:14 -06:00
Siddharth Agarwal
a73b9bb788 ffi: extend _list and _vector to support zero-length output 2012-03-29 14:55:14 -06:00
Eli Barzilay
592d23f5b5 Minor improvement: use `make-rename-transformer' instead of a macro. 2012-03-25 20:57:53 -04:00
Matthew Flatt
a884c91720 ffi/unsafe: add `array-length'
Closes PR 12576
2012-02-20 08:09:06 -07:00
Matthew Flatt
f461d9f67d ffi: fix _x-pointer/null' when _x' has a supertype
This is more specifically a bug in `_cpointer/null', but it
shows up most easily through C structs.
2012-02-17 06:36:23 -07:00
Matthew Flatt
6cd2e3c71b add `prop:cpointer'
Extend `define-cstruct' to support #:property specs, which causes
the constructor and C->Racket coercsions to wrap the pointer in
a structure instance with the specified properties. Of course,
the wrapper structure has a `prop:cpointer' property so that the
wrapper can be used transparently as a C pointer.

Add missing tests and documentation for the id`->list', `list->'id,
id`->list*', and `list*->'id bindings created by `define-cstruct'.
2012-02-14 14:25:55 -07:00
Matthew Flatt
13a5b0c623 change `ffi-lib' to not make library symbols global by default 2012-01-26 09:30:25 -05:00
Matthew Flatt
745c4b6470 fix another way that `racket/gui' instances can leak 2011-12-02 15:48:29 -07:00
Matthew Flatt
75dd61ebc3 fix leak in `racket/draw' instantiation 2011-11-11 16:32:16 -07:00
Matthew Flatt
8bd81f4806 fix ffi retain of callbacks
The FFI's weak table of callback procedures (to map Racket procedures
to FFI callback objects) suffered from the classic key-in-value
problem.

Closes PR 12228, probably

Merge to 5.2
2011-10-09 09:01:15 -06:00
Matthew Flatt
f38e57ff68 add #:get-lib-dirs and #:fail args to `ffi-lib'
Not currently used, because an experiment that used the additions
was abandoned, but another use in the future seems likely.
2011-10-05 06:28:30 -06:00
Matthew Flatt
0197902309 add var-ref->mod-decl-insp' and switch cur-code-insp' uses
Macros and other tools that need syntax privilege used
`(current-code-inspector)' at the module top-level to try to
capture the right code inspector at load time. It's more
consistent to instead use the enclosing module's declaration-time
inspector, and `var-ref->mod-decl-insp' provides that. The
new function works only on references to anonymous variables,
which limits access to the inspector.

The real function name is longer, of course.
2011-09-20 13:50:36 -06:00
Eli Barzilay
57ea31cca2 With 4f83f7f, the hack around PR7104 is no longer needed. 2011-08-29 16:36:24 -04:00
Kevin Tew
a810b30b87 remove underscore from cpointer key 2011-08-29 08:44:32 -06:00
Kevin Tew
fa4bb9dda0 Change cpointer tag to be a symbol 2011-08-23 13:33:06 -06:00
Matthew Flatt
345b06838d FFI: add C arrays and unions 2011-08-20 10:24:32 -06:00
Matthew Flatt
1160d3df62 remove syntax certificates; add syntax taints 2011-06-29 19:15:48 -06:00
Matthew Flatt
49aadc599a ffi: add `#:in-original-place?' to deal with thread-unsafe libs
and use it for Pango, which is not thread-safe at the C level
2011-05-13 08:55:04 -06:00
Matthew Flatt
3bf438f580 rewrite `ffi-lib' docs with better guidance on versions 2011-05-03 13:16:21 -06:00
Matthew Flatt
2ada6d0e89 break link to namespaces from from closures over top-/module-level vars
- the `lam' structure from `compiler/zo-struct' changed to include a
   `toplevel-map' field

 This change helps solve a finalization problem in `racket/draw',
 which in turn sigificantly reduces the peak memory use of `raco setup'
 during the doc-building phase (because some documents load `racket/draw'
 to render images, and multiple copies of `racket/draw' were retained
 before finalization was fixed).

 The change is an extreme way to solve a specific finalization
 problem, but it's a kind of space-safety improvement; space safety
 almost never matters, but when it does, then working around a lack of
 space safety is practically impossible. In this case, it's not clear
 how to otherwise solve the `racket/draw' finalization problem.

 The improvement doesn't change the representation of closures, but it
 requires special cooperation with the GC. All closures in a module
 continue to share the same array of globals (plus syntax objects);
 that is, instead of completely flat closures, Racket uses a two-level
 environment where top-/module-level variables are grouped
 together. The code half of a closure now records which
 top-/module-level variables the body code actually uses, and the mark
 phase of GC consults this information to retain only parts of the
 top-/module-level environment frame that are actually used by some
 closure (or all of the frame if it is accessible through some other
 route).  In other words, the GC supports a kind of "dependent
 reference" to an array that is indexed by positions into the array
 --- except that the code is more in the "Racket" directory instead of
 the "GC" directory, since it's so specific to the closure
 representation.
2011-05-03 06:57:49 -06:00
Jon Rafkind
3f572809c9 better error message when pre: or post: is used incorrectly 2011-04-18 17:27:21 -06:00
Eli Barzilay
b8bbed6eb4 Throw an error when translating an unknown enum integer to a symbol.
Also, add a keyword argument that can be used to get the old behavior
back.

Also, improve the way the `_enum' and `_bitmask' functions are wrapped.
2010-11-16 15:19:38 -05:00
Eli Barzilay
4f36ce9635 Redo `define-cstruct' with proper errors and more concisely. 2010-11-12 17:21:11 -05:00
Jon Rafkind
de16fb118e improve define-cstruct error messages. closes pr11422 2010-11-11 13:27:49 -07:00
Eli Barzilay
735c4deac7 Throw a proper syntax error on uses of the ffi `->'.
Closes PR 11421
2010-11-11 13:39:49 -05:00
Matthew Flatt
58e1e37734 fix bug in ffi struct alignment 2010-11-05 15:54:51 -06:00
Matthew Flatt
d2275f4179 level-2 finalization from ffi/unsafe and late-weak references 2010-11-05 15:54:47 -06:00
Matthew Flatt
40a65a46d2 overhaul GC finalization 2010-11-05 15:54:47 -06:00
Matthew Flatt
e9e180847a enforce modality; more on-subwindow- callbacks; Cocoa font tweaks 2010-11-05 15:54:11 -06:00
Matthew Flatt
6e23fcda5f fix _short' and other non-_int' integer types, and add `_intptr' test 2010-10-13 08:50:47 -06:00
Eli Barzilay
615d8f1329 Add _intptr etc; closes PR11311. 2010-10-12 20:58:08 -04:00
Matthew Flatt
d6684dad8c fix cstruct alignment handling 2010-10-01 10:49:40 -06:00
Matthew Flatt
17cdb9eb3b move #:alignment option for `define-cstruct' to end
to make it consistent with options for `struct' and `define-struct'
2010-09-10 08:06:41 -06:00
Matthew Flatt
5a833ffc57 fix optional argument of _list-cstruct 2010-09-10 07:55:58 -06:00
Matthew Flatt
6ac15688b2 add alignment option to ffi's cstruct support 2010-09-10 06:59:52 -06:00
Eli Barzilay
606b7f60dc Lots of "~e" to "~.s" changes. 2010-08-25 17:17:01 -04:00
Matthew Flatt
8df33b629e fix default #:keep argument of _cprocedure 2010-08-07 20:40:42 -05:00
Matthew Flatt
768a3721f9 add async-apply support to FFI 2010-07-11 14:59:40 -06:00
Matthew Flatt
b7c184632b racket/unsafe/ffi -> ffi/unsafe, etc. 2010-04-26 18:05:29 -06:00