Re: smob gc protection, and inheritance

2013-09-07 Thread Andy Wingo
On Tue 03 Sep 2013 21:27, Doug Evans  writes:

> 2) Is it possible to inherit, e.g., with goops, a smob?
> IOW, can I extend a smob through inheritance?
> Or must I store the smob in a class, and provide accessors?
> [kinda like the "is a" vs "has a" relationship]

You can't really inherit from a SMOB in GOOPS.  SMOB types have
corresponding GOOPS classes, but in a practical sense they can only be
used as specializers on methods; they aren't useful as constructors or
superclasses.  This is because GOOPS objects and SMOB objects have
different representations.

It's possible to do SMOB-like things in GOOPS but it is tricky and not
well documented.  Guile-GNOME does this; see
http://git.savannah.gnu.org/cgit/guile-gnome.git/tree/glib/gnome/gobject/gtype.scm
for more.

Lately what I have been doing is just using the FFI, and setting
finalizers on pointers as needed.

Regards,

Andy
-- 
http://wingolog.org/



Re: guile-dbi cores in mark_db_handle

2013-09-07 Thread Andy Wingo
On Fri 30 Aug 2013 09:21, Andrew Gaylard  writes:

> Program terminated with signal 10, Bus error.
> #0  0x75601c8c in mark_db_handle (g_db_handle_smob=0x10115efc0)
> at guile-dbi.c:114
> 114   scm_gc_mark(g_db_handle->bcknd);
> (gdb) p g_db_handle
> $1 = (gdbi_db_handle_t *) 0x304
>
> That 0x304 is SCM_EOL. The only part of guile-dbi.c which looks like it
> could be
> causing this is free_db_handle, which does this:
>
> SCM_SETCDR (g_db_handle_smob, SCM_EOL);

Hummm.  Could it be this?

  http://lists.gnu.org/archive/html/guile-user/2011-11/msg00069.html

Andy
-- 
http://wingolog.org/



Re: xdgdirs 1.0

2013-09-07 Thread Andy Wingo
Just a bunch of random things.  No opinion about module names, etc :)

On Thu 05 Sep 2013 12:42, Thien-Thi Nguyen  writes:

> (define mentioned?
>   (let ((cl (command-line)))
> (lambda (opt)
>   (member opt cl

You could do this as (cute member <> (command-line)), having imported
srfi-26.

> (cond ((mentioned? "--help")
>(use-modules (ice-9 documentation))
>(fso "~A~%" (file-commentary (car (command-line
>(exit #t)))

Here I think "when" is much more readable.  Also, you can use
"(current-file-name)" for a more reliable way to get the current file
name.

> (cond ((mentioned? "--version")
>(fso "xdgdirs ~A~%~A~%" VERSION COPYRIGHT)
>(fso "~A ~A~%~A~%~A~%"
> "License GPLv3+: GNU GPL version 3 or later"
> ""
> "This is free software: you are free to change and redistribute 
> it."
> "There is NO WARRANTY, to the extent permitted by law.")
>(exit #t)))

You can use (ice-9 command-line)'s version-etc.

Regards,

Andy
-- 
http://wingolog.org/



Re: xdgdirs 1.0

2013-09-07 Thread Thien-Thi Nguyen
() Andy Wingo 
() Sat, 07 Sep 2013 10:36:38 +0200

   > (define mentioned? ...)

   You could do this as (cute member <> (command-line)),
   having imported srfi-26.

   > (cond ((mentioned? "--help") ...)

   Here I think "when" is much more readable.  Also, you can use
   "(current-file-name)" for a more reliable way to get the current
   file name.

   > (cond ((mentioned? "--version") ...)

   You can use (ice-9 command-line)'s version-etc.

Thanks for the tips.  I'll try to keep these in mind.

-- 
Thien-Thi Nguyen
   GPG key: 4C807502
   (if you're human and you know it)
  read my lisp: (responsep (questions 'technical)
   (not (via 'mailing-list)))
 => nil


pgpe6bonY7Qk3.pgp
Description: PGP signature


Re: Problem with wide characters on upgrading to guile 2.x

2013-09-07 Thread Andy Wingo
On Mon 02 Sep 2013 10:48, Richard Shann  writes:

> On Thu, 2013-08-22 at 12:14 -0700, Mike Gran wrote:
>> >>  2. In the inner_main of your scm_with_guile call, 
>> 
>> >>  try calling scm_setlocale.  Maybe something like this?
>> >>  (This shouldn't make a difference, I think. 
>> >>  But, if it does, it says something interesting.)
>> >> 
>> >>  scm_setlocale( scm_variable_ref(scm_c_lookup("LC_ALL")), 
>> > scm_from_locale_string("") );
>> > 
>> >>   If that actually works, lemme know.
>> > 
>> > I just pasted the above into the start of inner_main() and like magic,
>> > it has fixed the problem. Is this call ok for guile-1.8 linking too?
>> 
>> I'm not 100% sure, but, I think so.
>
> I have located a problem which arises I think when LC_ALL is not set
> (the actual circumstance I triggered by setting LANG to a language not
> installed):
>
> 8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><
> Backtrace:
> In ice-9/boot-9.scm:
>  149: 2 [catch #t # ...]
>  157: 1 [#]
> In unknown file:
>?: 0 [catch-closure]
>
> ERROR: In procedure catch-closure:
> ERROR: In procedure setlocale: Invalid argument
> 8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><

const char prog[] =
  "(catch #t
 (lambda () (setlocale LC_ALL \"\"))
 (lambda _
   (display \"Locale not supported by the C library.
Falling back to default \\\"C\\\" locale.\\n\"
(current-error-port";
scm_c_eval_string (prog);

Andy
-- 
http://wingolog.org/



Re: Guile-Emacs update

2013-09-07 Thread Andy Wingo
On Thu 01 Aug 2013 00:17, taylanbayi...@gmail.com (Taylan Ulrich B.) writes:

> the "dumping" feature of Emacs is disabled

Eventually Guile will support linking together multiple separately
compiled files into one ELF image.  (The object file format in the
development Guile branch is ELF -- we have our own linker and loader, so
we currently plan on using this format even on non-ELF platforms.)  That
should mostly provide the speedy loading that the dumping facility gives
to Emacs.  Loading a file would look for the appropriate entry point in
the image and load that.  There is still some runtime relocation and
initialization that needs to happen, but it should be possible to get
most of the advantages of the "dump" phase.

Andy
-- 
http://wingolog.org/



Re: Guile wiki

2013-09-07 Thread Andy Wingo
On Fri 26 Jul 2013 19:59, hellekin  writes:

> 2. Move http://www.gnu.org/software/guile/ideas.html to the wiki
>
> Ideas are cheap: that's typically something very suited for a wiki, so
> that anyone can edit the page without having to bother a webmaster
> into the process. Cut the middleman.
>
> Tasks for the webmaster: link to the wiki :)

Very much agreed :)

Andy
-- 
http://wingolog.org/



Re: Determining programatically whether the interpreter is Guile or Clisp or Emcs

2013-09-07 Thread Andy Wingo
On Mon 29 Jul 2013 10:36, Nala Ginrut  writes:

> If you just want to check whether a symbol was defined, try:
> (module-defined? (current-module) 'function-lambda-expression)

Alternate spelling: (defined? 'foo)

Andy
-- 
http://wingolog.org/



Re: Easiest way to set procedure-documentation?

2013-09-07 Thread Andy Wingo
Hi Roland,

If you want to give documentation to procedures defined in C with
SCM_DEFINE, you can associate an external documentation file with the
module.  See
http://git.savannah.gnu.org/cgit/guile-cairo.git/tree/cairo/Makefile.am
and http://git.savannah.gnu.org/cgit/guile-cairo.git/tree/cairo.scm.

A patch to the Guile manual would be wonderful :-)

Andy
-- 
http://wingolog.org/



Re: Memory use analysis

2013-09-07 Thread Andy Wingo
On Tue 13 Aug 2013 20:23, m...@markwitmer.com writes:

> I'm facing an issue with ballooning memory usage in a progam I'm writing
> and having a difficult time tracking down the root cause. The stack
> stays small but it uses more and more heap space until the system runs
> out of memory.

We don't have good tools for this :(

However you can set the GC_PRINT_STATS or GC_PRINT_VERBOSE_STATS
environment variables, and perhaps that is helpful to you.

Andy
-- 
http://wingolog.org/



Re: Creating a top level definition if none so far exists, on the fly.

2013-09-07 Thread Andy Wingo
On Thu 15 Aug 2013 15:37, Richard Shann  writes:

> Hmm, so I asked about this before in February. Gives me an idea of the
> extent of my memory span - it didn't even ring a bell.

You know, I forgot about the answer too ;-)

Andy
-- 
http://wingolog.org/



Re: Guile-Emacs update

2013-09-07 Thread Eli Zaretskii
> From: Andy Wingo 
> Date: Sat, 07 Sep 2013 11:29:10 +0200
> Cc: guile-user@gnu.org, BT Templeton , joa...@verona.se,
>   emacs-de...@gnu.org
> 
> On Thu 01 Aug 2013 00:17, taylanbayi...@gmail.com (Taylan Ulrich B.) writes:
> 
> > the "dumping" feature of Emacs is disabled
> 
> Eventually Guile will support linking together multiple separately
> compiled files into one ELF image.  (The object file format in the
> development Guile branch is ELF -- we have our own linker and loader, so
> we currently plan on using this format even on non-ELF platforms.)

Was this ever tested on any non-ELF platform, such as MinGW?



Re: Guile-Emacs update

2013-09-07 Thread Andy Wingo
On Sat 07 Sep 2013 12:02, Eli Zaretskii  writes:

>> From: Andy Wingo 
>> Date: Sat, 07 Sep 2013 11:29:10 +0200
>> Cc: guile-user@gnu.org, BT Templeton , joa...@verona.se,
>>  emacs-de...@gnu.org
>> 
>> On Thu 01 Aug 2013 00:17, taylanbayi...@gmail.com (Taylan Ulrich B.) writes:
>> 
>> > the "dumping" feature of Emacs is disabled
>> 
>> Eventually Guile will support linking together multiple separately
>> compiled files into one ELF image.  (The object file format in the
>> development Guile branch is ELF -- we have our own linker and loader, so
>> we currently plan on using this format even on non-ELF platforms.)
>
> Was this ever tested on any non-ELF platform, such as MinGW?

It just landed a couple months ago, so the time for that hasn't really
come yet.  But it doesn't rely on any interfaces of the platform, so I
don't anticipate problems.

Andy
-- 
http://wingolog.org/



xdgdirs 2.0 available

2013-09-07 Thread Thien-Thi Nguyen
release notes:

  OK, so i succumbed to the over-engineering bad habit,
  rationalizing it back under the tasteful threshold by
  expanding the scope of the problem.  Hee hee.

  thi

README excerpt:

  This directory contains the program ‘xdgdirs’,
  released under the terms of the GNU GPLv3+.

  It displays the names and values of the XDG_* env vars
  related to the XDG Basedir Specification:

http://http://standards.freedesktop.org/basedir-spec/

  formatted as a Scheme- and Lisp-friendly alist, or optionally
  as an associative array in the literal data syntax of various
  languages.

NEWS excerpt:

  - 2.0 | 2013-09-07

- Initial release

  There was a version 1.0, but that was not a proper package:
  

tarball, etc, in dir:

  http://www.gnuvola.org/software/xdgdirs/

atom feed:

  http://www.gnuvola.org/NEWS.xml.gz

-- 
Thien-Thi Nguyen
   GPG key: 4C807502
   (if you're human and you know it)
  read my lisp: (responsep (questions 'technical)
   (not (via 'mailing-list)))
 => nil


signature.asc
Description: PGP signature


Re: smob gc protection, and inheritance

2013-09-07 Thread Ludovic Courtès
Andy Wingo  skribis:

> Lately what I have been doing is just using the FFI, and setting
> finalizers on pointers as needed.

This is by far the most flexible approach.

Ludo’.




xdgdirs 2.1 available

2013-09-07 Thread Thien-Thi Nguyen
release notes:

  Small changes, no big deal.

  thi

README excerpt:

  This directory contains the program ‘xdgdirs’,
  released under the terms of the GNU GPLv3+.

  It displays the names and values of the XDG_* env vars
  related to the XDG Basedir Specification:

http://standards.freedesktop.org/basedir-spec/

  formatted as a Scheme- and Lisp-friendly alist, or optionally
  as an associative array in the literal data syntax of various
  languages.

NEWS excerpt:

  - 2.1 | 2013-09-08

- single-char options supported

  These are ‘-s’, ‘-D’ and ‘-l’, short for ‘--sequence’,
  ‘--no-defaults’ and ‘--lang’, respectively.

- distribution includes HTML and PDF manual

  These are also provided on the home page.

- ‘--help’ output includes bug-report and home page info

  Who knows?  Maybe xdgdirs can become part of GNU someday.

tarball, etc, in dir:

  http://www.gnuvola.org/software/xdgdirs/

atom feed:

  http://www.gnuvola.org/NEWS.xml.gz

-- 
Thien-Thi Nguyen
   GPG key: 4C807502
   (if you're human and you know it)
  read my lisp: (responsep (questions 'technical)
   (not (via 'mailing-list)))
 => nil


signature.asc
Description: PGP signature