A question about scm_{to,from}_locale_string()

2011-06-11 Thread Peter TB Brett
Hi folks,

gEDA currently uses scm_to_locale_string() and scm_from_locale_string()
to convert C char* strings to and from SCM strings.

All of our strings are encoded as UTF-8, but we can't use
scm_to_utf8_stringn() and scm_from_utf8_string() because they don't
exist in Guile 1.8.8 (which we're going to have to continue to support
for some time).

The question, then, is whether using scm_{to,from}_locale_string() with
UTF-8 strings will "just work" in both Guile 1.8.8 and Guile 2.0.1 as
long as we make sure that the current locale is a UTF-8 locale?

Thanks in advance,

   Peter

-- 
Peter Brett 
Remote Sensing Research Group
Surrey Space Centre


pgprsbFQ1FZtb.pgp
Description: PGP signature


Re: A question about scm_{to,from}_locale_string()

2011-06-11 Thread Ludovic Courtès
Hello,

Peter TB Brett  skribis:

> All of our strings are encoded as UTF-8, but we can't use
> scm_to_utf8_stringn() and scm_from_utf8_string() because they don't
> exist in Guile 1.8.8 (which we're going to have to continue to support
> for some time).
>
> The question, then, is whether using scm_{to,from}_locale_string() with
> UTF-8 strings will "just work" in both Guile 1.8.8 and Guile 2.0.1 as
> long as we make sure that the current locale is a UTF-8 locale?

Yes, it should work.

However, in Guile 2.0.x, you'd better use scm_{to,from}_utf8_string to
avoid relying on the locale settings.  You could use a configure check
for that.

Thanks,
Ludo'.




Guile + Mercury / GC

2011-06-11 Thread Tomas By
Hi all,

After upgrading to Guile 2.0.1, my Mercury - Guile app stopped working.

| $ ./test
| 0xac44040 is not a GC visible pointer location
| GC_is_visible test failed
| Aborted
| $

All source files for a minimal example shown below.

Any help appreciated.

/Tomas

---test.c 
#include 
#include 
#include "hercules.h"
#include "azoth.mh"

int main(int argc,char** argv)
{
  void* dummy;
  mercury_init(argc,argv,&dummy);
  scm_boot_guile(argc,argv,inner_main,NULL);
  return 0;
}

static void inner_main(void* data,int argc,char** argv)
{
  scm_shell(argc,argv);
}
-- azoth.m ---
:- module azoth.
:- interface.
:- pred azoth is det.
:- implementation.
azoth.
:- end_module azoth.
---Makefile --
nothing: test

MMC = mmc
MMAKE = mmc --make

CC = $(shell $(MMC) --output-cc)
LD = $(shell $(MMC) --output-link-command)

GUILE_CFLAGS=$(shell pkg-config --cflags guile-2.0)
GUILE_LIBS=$(shell pkg-config --libs guile-2.0)

MERCURY_CFLAGS=$(shell $(MMC) --output-cflags)
MERCURY_LIBS=$(shell $(MMC) --mercury-linkage static
--output-library-link-flags)

CFLAGS = $(MERCURY_CFLAGS) $(GUILE_CFLAGS)
LDFLAGS = $(MERCURY_LIBS) $(GUILE_LIBS)

azoth.init : azoth.m
$(MMC) --make libazoth

azoth_int.o : azoth.init
$(MMC) --ml azoth --generate-standalone-interface hercules

test.o : test.c azoth.init azoth_int.o
$(CC) $(CFLAGS) -c test.c

test : test.o azoth_int.o azoth.init
$(LD) -o test test.o hercules.o libazoth.a $(LDFLAGS)
--