Johann 'Myrkraverk' Oskarsson writes:
This void pointer is kind of "bothering" me. I can quite
easily
return nil from (get cursor 'data) and I can also signal an error.
Are there any other sane options?
You can return a type derived from Lisp_Opaque object, which is just a
blob of memory containing the data. That's all you need to do if it
just gets passed to other libClang objects. Turning it into an
integer or the like is a bad idea, as that means you can't type check
objects passed to libClang interfaces.
On the other hand (object-plist cursor) isn't even implemented,
and
I have no idea what to do with it. Any ideas?
Property lists are application-specific, user-supplied attributes. If
the cursor type doesn't need them you don't need to implement it.
Also, the (get cursor 'kind) returns another type, which I've
not yet
wrapped. This is an enumerator documented at
http://clang.llvm.org/doxygen/group__CINDEX.html#gaaccc432245b4cd9f2d4709...
and I wonder what some options are to represent this in elisp?
I would most likely use symbols. Whether to use keywords is a matter
of taste. I probably wouldn't. Using integers isn't a great idea;
you can't type check them. If you need to allow users to write
programs where the ints in the underlying enum are directly input,
that can be done with a helper program at the Lisp level. But I would
not support that -- I'd tell the user to write their own
int-to-enumerator helper function if they want that. Creating a
separate enum type seems like overengineering; if you want to
introspect the set of enumerators, a defconst at Lisp level seems
sufficient. If you really want to, you can create that list read-only
at the C level in your module.
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta