public inbox for guile-gtk@sourceware.org
 help / color / mirror / Atom feed
* Constant strings in guile-gtk...
@ 2001-01-21 13:03 Ariel Rios
  2001-01-28 10:35 ` Marius Vollmer
  0 siblings, 1 reply; 2+ messages in thread
From: Ariel Rios @ 2001-01-21 13:03 UTC (permalink / raw)
  To: guile-gtk; +Cc: mvo

Hi,
I have been wondering that guile-gtk might need
to handle const char* since a lot of of 
GNOME code is now declaring things like that...

I hacked:

  (register-type
   'cstring
   (make-type "cstring" "const char*"
	       (lambda (x) 
		(@@ "(SCM_NIMP(~a) && SCM_RWSTRINGP(~a))" x x))
	         (lambda (x copy) 
		(@@ "(~a == NULL? SCM_BOOL_F : scm_take0str ((char *)~a))"
x x))
	      'fit-for-list #t
	      'conversion "sgtk_string_conversion"))

But that seems not a good thing... I use 'sgtk_string_conversion'
for I did not found what "conversion" is suppose to do.
Also, I am only getting parse error when declaring something as 
'cstring' like:

(define-func e_cell_text_new
  ECell
  ((cstring fontname)
   (GtkJustification justify)))


ariel



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Constant strings in guile-gtk...
  2001-01-21 13:03 Constant strings in guile-gtk Ariel Rios
@ 2001-01-28 10:35 ` Marius Vollmer
  0 siblings, 0 replies; 2+ messages in thread
From: Marius Vollmer @ 2001-01-28 10:35 UTC (permalink / raw)
  To: Ariel Rios; +Cc: guile-gtk

Ariel Rios <ariel@arcavia.com> writes:

> Hi,
> I have been wondering that guile-gtk might need
> to handle const char* since a lot of of 
> GNOME code is now declaring things like that...

I think you want to use

  (register-type 
   'cstring
   (make-type "cstring" "const char*"
	      (lambda (x)
		(@@ "(SCM_NIMP(~a) && SCM_ROSTRINGP(~a))" x x))
	      (lambda (x)
		(@@ "((~a) == SCM_BOOL_F? NULL : SCM_CHARS(~a))" x x))
	      (lambda (x copy)
		(@@ "(~a == NULL? SCM_BOOL_F : scm_take0str (~a))" x x))
	      'fit-for-list #t
	      'conversion "sgtk_string_conversion"))

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-01-28 10:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-21 13:03 Constant strings in guile-gtk Ariel Rios
2001-01-28 10:35 ` Marius Vollmer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).