emacs-devel
[Top][All Lists]
Advanced

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

Re: implementing curl module with opaque emacs types


From: Stephen Leake
Subject: Re: implementing curl module with opaque emacs types
Date: Tue, 17 Feb 2015 13:33:33 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (windows-nt)

Stephen Leake <address@hidden> writes:

> Stephen Leake <address@hidden> writes:
>
>> So let's take a stab at something closer to your approach.
>>
>> I'm not familiar with the idioms for making an opaque type in C; would
>> that just be a pointer to void? something like:
>>
>> typedef void*  Lisp_Object_Ptr;
>
> Here is the list of Emacs functions that curl.c currently uses
>
>     Fprovide
>     SSDATA
>     XSAVE_POINTER
>     builtin_lisp_symbol (for Qnil)
>     defsubr
>     intern
>     make_string
>
> We can either implement these in a new version of emacs_module_api.h/.c,
> or rewrite curl.c to not use them.

Attached is a first attempt at emacs_module_api.h for this. The only
change in curl.c is:

-#include <config.h>
-#include <lisp.h>
+/* #include <config.h> */
+/* #include <lisp.h> */
+#include "emacs_modules_api.h"


This gives compilation errors:

curl.c: In function 'init':
curl.c:113:13: error: 'Scurl_make' undeclared (first use in this function)
   defsubr (&Scurl_make);
             ^
curl.c:113:13: note: each undeclared identifier is reported only once for each 
function it appears in
curl.c:114:13: error: 'Scurl_fetch_url' undeclared (first use in this function)
   defsubr (&Scurl_fetch_url);
             ^
curl.c:115:13: error: 'Scurl_content' undeclared (first use in this function)
   defsubr (&Scurl_content);
             ^
curl.c:116:13: error: 'Scurl_free' undeclared (first use in this function)
   defsubr (&Scurl_free);
             ^
Makefile:14: recipe for target 'curl.o' failed

This is because I deleted the declaration of 'sname' from the DEFUN
macro, because I couldn't figure out how to implement it simply.

It seems EXFUN is redundant with the first part of DEFUN, so I'm not
sure why the EXFUN statments are in curl.c.

So we either need a lisp wrapper to declare the module functions, with
some way to lookup the EXFUN symbols to set the function values, or we
need to implement a C function (not macro) that creates the struct for
defsubr.

-- 
-- Stephe

Attachment: emacs_modules_api.h
Description: Binary data


reply via email to

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