* writing an elisp interface to a c library
@ 2005-08-18 10:44 James Cloos
2005-08-18 11:29 ` Masatake YAMATO
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: James Cloos @ 2005-08-18 10:44 UTC (permalink / raw)
Can anyone point me to a good example in the emacs codebase of a lisp
api that closely matches an existing external c api? So far I've only
hacked the elisp part of emacs, not the C....
I presume I'll need to create some read-only lisp integers matching
the names of the various enum values, lisp objects to hold the (opaque)
structs the lib uses and DEFUNs to match the lib's api? I have read
the primitives section of the elisp manual, but which src files are
the best to study?
(As I see it, the lib's api is such that it can be mapped to lisp w/o
diverging from its C look and feel. Following that api very closely,
then, seems to be the Right Thing To Do. Being able to write all of
the higher-level code using the lib in elisp is enticing.)
I'm primarily targetting the emacs-unicode-2 branch for this project,
if it makes any difference.
Thanks,
-JimC
--
James H. Cloos, Jr. <cloos@jhcloos.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: writing an elisp interface to a c library
2005-08-18 10:44 writing an elisp interface to a c library James Cloos
@ 2005-08-18 11:29 ` Masatake YAMATO
2005-08-18 13:16 ` Thien-Thi Nguyen
2005-08-31 0:22 ` James Cloos
2 siblings, 0 replies; 4+ messages in thread
From: Masatake YAMATO @ 2005-08-18 11:29 UTC (permalink / raw)
Cc: emacs-devel
> Can anyone point me to a good example in the emacs codebase of a lisp
> api that closely matches an existing external c api? So far I've only
> hacked the elisp part of emacs, not the C....
>
> I presume I'll need to create some read-only lisp integers matching
> the names of the various enum values, lisp objects to hold the (opaque)
> structs the lib uses and DEFUNs to match the lib's api? I have read
> the primitives section of the elisp manual, but which src files are
> the best to study?
I don't know well about the C side. However, I think M-x describe-function
on a built-in function is really helpful. Because its *Help* buffer
contains a link to its definition in a C source file.
Try "M-x describe-function car" to know about list.
Try "M-x describe-function to numberp" to know about number...
I feel strong GNU'ism from the link.
Masatake YAMATO
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: writing an elisp interface to a c library
2005-08-18 10:44 writing an elisp interface to a c library James Cloos
2005-08-18 11:29 ` Masatake YAMATO
@ 2005-08-18 13:16 ` Thien-Thi Nguyen
2005-08-31 0:22 ` James Cloos
2 siblings, 0 replies; 4+ messages in thread
From: Thien-Thi Nguyen @ 2005-08-18 13:16 UTC (permalink / raw)
Cc: emacs-devel
James Cloos <cloos@jhcloos.com> writes:
> (As I see it, the lib's api is such that it can be mapped to lisp w/o
> diverging from its C look and feel. Following that api very closely,
> then, seems to be the Right Thing To Do. Being able to write all of
> the higher-level code using the lib in elisp is enticing.)
how close/far/easy/difficult it is depends on the C library's interface.
check out http://www.swig.org for an interface mapping mux approach.
it would be cool to see an emacs lisp module for swig.
thi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: writing an elisp interface to a c library
2005-08-18 10:44 writing an elisp interface to a c library James Cloos
2005-08-18 11:29 ` Masatake YAMATO
2005-08-18 13:16 ` Thien-Thi Nguyen
@ 2005-08-31 0:22 ` James Cloos
2 siblings, 0 replies; 4+ messages in thread
From: James Cloos @ 2005-08-31 0:22 UTC (permalink / raw)
For the archives, src/xfaces.c is a good example to look at after
reading the relevant sections of the elisp manual.
I browsed through all of src; of all of the .c files, xfaces.c
deals with an api most similar to what I asked about.
-JimC
--
James H. Cloos, Jr. <cloos@jhcloos.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-08-31 0:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-18 10:44 writing an elisp interface to a c library James Cloos
2005-08-18 11:29 ` Masatake YAMATO
2005-08-18 13:16 ` Thien-Thi Nguyen
2005-08-31 0:22 ` James Cloos
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.