emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to add pseudo vector types


From: Yuan Fu
Subject: How to add pseudo vector types
Date: Wed, 14 Jul 2021 13:37:47 -0400

Say I want to expose tree-sitter’s parser to lisp, and I define it as a new 
pseudo vector.

struct Lisp_TS_Parser
{
  union vectorlike_header header;
  Lisp_Object buffer;
  TSParser *parser;
  TSTree *tree;
  TSInput input;
};

Now if I want to return a Lisp_Object, do I initialize this struct and cast it 
into a Lisp_Object and return it? Like:

Lisp_TS_parser lisp_parser;
...
return (Lisp_Object)lisp_parser;


And how do I use a USER_PTR? Do I cast it into (struct Lisp_User_Ptr) and use 
it normally, or is there some helper function that I should use?

Are there examples of using pseudo vectors? Thanks

Yuan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]