wrap-callback-quot ( params quot -- quot' )


Vocabulary
stack-checker.alien

Inputs
paramsan alien-node-params
quota quotation


Outputs
quot'a quotation


Word description
Wraps the given quotation in protective packaging so that it becomes suitable to be used as an alien callback. That means that the parameters are unpacked from C types to Factor types and, if the callback returns something, the top data stack item is afterwards converted to a C compatible value.

Examples
Here a callback that returns the length of a c-string is wrapped:
USING: alien.c-types prettyprint stack-checker.alien ; T{ alien-node-params { return int } { parameters { c-string } } } [ length ] wrap-callback-quot . [ [ { object } declare [ ] dip utf8 alien>string length >fixnum ] [ dup current-callback eq? [ drop ] [ wait-for-callback ] if ] do-callback
]


Definition


Methods