English 中文(简体)
缩略语
原标题:Using _bitmask from PltScheme FFI

它是带式图书馆的一部分:

(define InputMask

  (_bitmask  (NoEventMask =            #x00000000

            KeyPressMask =             #x00000001

            KeyReleaseMask =           #x00000002

            ...

            OwnerGrabButtonMask =      #x01000000)

      _long))

我必须说明,如何进入比特马克(或为此而设)的田地。 例如,我如何获得关键Press Mask的价值?

最佳回答

页: 1 添加这种类型是容易的:为了形成一种新的类型,你需要提供一种现有的类型,以充实和发挥两项职能——一种是翻译任何一种现有类型,另一种是翻译另一种方式。

现在,<代码>_bitmask 仅此类型——它以<代码>_int为基础。 (但就您的情况而言,它载于_long,而两个翻译职能将一个符号清单译成星体,并将一个星号转换成一个符号清单。 一旦使用这种编号,你就不必知道<代码>的价值。 KeyPressMask ——你刚刚知道你可以通过<代码>(KeyPressMask),作为<条码>输入外国功能,并将译成适当编号;你还知道,如果你从拥有<条码>的“InputMask输出的功能中获得结果价值,那么,它将成为一份可能包含<条码>的符号>的符号清单。 底线是,在计划一侧,你没有处理编号——只有文号清单。

如果你do出于某种模糊原因需要获得这些价值,那么你可以以某种其他方式建立自己的类型——使用<代码>make-ctype(如上所述)是非常容易的。

问题回答

暂无回答




相关问题
Parsing with DCGs in Scheme (without Prolog)?

Lots of Prolog-in-Scheme implementations are out there. E.g. Kanren, Schelog. Apparently in "Paradigms of AI Programming" Norvig implements Prolog-to-Lisp compiler in Lisp in order to use Definite ...

Applying a symbol as a procedure

Suppose I have a simple symbol: > + + Is there any way I can apply that symbol as a procedure: > ((do-something-with +) 1 2) 3 So that + is evaluated to the procedure +?

string-split in DrScheme

How do I do equivalent of python s str.split in DrScheme? SRFI-13 doesn t seem to have it provided.

Scheme, getting the pointer from pointed struct

Assume I have a such struct: (define-struct node (value next)) ;and making 2 nodes, parent pointing to child as next. (define child (make-node 2 null)) (define parent (make-node 1 child)) Under ...

How to solve the following equation using accumulate (Scheme)

I m trying to do the following problem (there is a formula so I print-screened and uploaded it) Formula http://img248.imageshack.us/img248/6558/problemh.jpg (http://img248.imageshack.us/img248/6558/...

热门标签