emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#10974: closed (address@hidden)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#10974: closed (address@hidden)
Date: Mon, 02 Jul 2012 19:23:02 +0000

Your message dated Mon, 02 Jul 2012 21:17:59 +0200
with message-id <address@hidden>
and subject line Re: bug#10974: address@hidden
has caused the debbugs.gnu.org bug report #10974,
regarding address@hidden
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
10974: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10974
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: address@hidden Date: Thu, 8 Mar 2012 12:36:37 +0100
Hi, All,

For use from a Fortran program I am collecting API fixes for libguile.so
as wrapper functions for what is provided to C-programs as macros.
I noted that some of the macros are function-macros some are symbol
macros. An example of the latter is

  #define scm_to_int scm_to_int23

This is inconsistent and makes escaping such macros slightly more difficult.
(Honestly I dont know a way yet).

One guile developer on IRC said this is "probably a good thing to fix"
so I report
it here. I dont build Guile 2 myself as the installations I use are quite
dated/conservative.

As a background, Fortran allows you to declare "foreign" functions, for example,
like this:

type, public, bind(c) :: scm_t
   private
   integer(c_intptr_t) :: do_not_ever_use
end type scm_t

interface
  function scm_symbol_p (obj) result (yes) bind (c)
     type(scm_t), intent(in), value :: obj
    type(scm_t) :: yes
  end function scm_symbol_p
  ...
end interface

This makes use of library functions quite handy. But it does not provide a
way to access a C-macro, naturally.

Alexei

#include <libguile.h>

SCM guile_macro_scm_from_int (int i);
int guile_macro_scm_to_int (SCM obj);

int (scm_is_true) (SCM obj);
int (scm_is_symbol) (SCM obj);

int (scm_is_null) (SCM obj);
SCM (scm_eol) (void);

SCM guile_macro_scm_from_int (int i)
{
  return scm_from_int(i);
}

int guile_macro_scm_to_int (SCM obj)
{
  return scm_to_int(obj);
}

int (scm_is_true) (SCM obj)
{
  return scm_is_true(obj);
}

int (scm_is_symbol) (SCM obj)
{
  return scm_is_symbol(obj);
}

int (scm_is_null) (SCM obj)
{
  return scm_is_null(obj);
}

SCM (scm_eol) ()
{
  return SCM_EOL;
}



--- End Message ---
--- Begin Message --- Subject: Re: bug#10974: address@hidden Date: Mon, 02 Jul 2012 21:17:59 +0200 User-agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.1 (gnu/linux)
Hi,

Alexei Matveev <address@hidden> skribis:

> It's ok. You may close it.

Thanks.

> I still think it could be less confusing if the libguile.so 
> implemented/provided
> functions as advertised in Guile API docs for the sake of interfacing to
> languages other than C. And &scm_from_int wold also work if it were a real
> function.
>
> But there are many more macros, so such a link-time interface would be a
> lot of work, I realize by now.

Yeah.  Though here, you could still write bindings for ‘scm_from_int32’
(the real function) instead of ‘scm_from_int’, for instance, no?

Thanks,
Ludo’.


--- End Message ---

reply via email to

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