comp.lang.ada
 help / color / mirror / Atom feed
* Bug in GtkAda
@ 2009-10-16  1:22 RasikaSrinivasan@gmail.com
  2009-10-16  7:33 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 4+ messages in thread
From: RasikaSrinivasan@gmail.com @ 2009-10-16  1:22 UTC (permalink / raw)


I have a piece of code that reads :
--------------------
      Gtk.Text_Attributes.Gtk_New(Special_Atr);
      Gdk.Color.Set_Rgb( Fg , 16#Ffff# , 0 , 0 ) ;
      Gtk.Text_Attributes.Set_Fg_Color
(Gtk.Text_Attributes.Get_Appearance(Special_Atr),Fg);
---------------

I am getting the following error while linking:

C:\Projects\Gtk\regexp>gprbuild -p -Pregexp
creating auto.cgpr
gcc -c -g -gnat05 -gnata regexp_widgets.adb
regexp_widgets.adb:41:04: warning: variable "Normal_Atr" is never read
and never assigned
regexp_widgets.adb:126:07: warning: variable "Searchbtn" is never read
and never assigned
gprbind regexp.bexch
gnatbind regexp.ali
gcc -c b__regexp.adb
gcc regexp.o -L/minsk.a/gnatmail/gcc-43/build-minsk/gtkada/install/lib/
gtkada/static -Wl,-luuid -L/minsk.a/gnatmail/gcc-43/install-minsk/gtk/
lib -L/unix/gtk+gps/
gimpwin-dev/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -limm32 -lshell32 -
lole32 -latk-1.0 -lgdk_pixbuf-2.0 -ljpeg -lpng -lpangocairo-1.0 -
lcairo -lpangowin32-1.0 -lgdi
32 -lpango-1.0 -lm -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -
luser32 -Lc:\gnat\2009\gtkada\lib\gnat\.. -Lc:\gnat\2009\gtkada\lib
\gnat\../../include/gtkada -
o regexp.exe
c:\projects\gtk\regexp\.objs\regexp_widgets.o: In function
`regexp_widgets__make':
c:/projects/gtk/regexp/regexp_widgets.adb:180: undefined reference to
`_ada_text_attribute_get_appearance'
collect2: ld returned 1 exit status
gprbuild: link of regexp.adb failed

------------------------------------------
Sounds like a bug to me. Any ideas?

thanks, srini



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

* Re: Bug in GtkAda
  2009-10-16  1:22 Bug in GtkAda RasikaSrinivasan@gmail.com
@ 2009-10-16  7:33 ` Dmitry A. Kazakov
  2009-10-16 10:20   ` RasikaSrinivasan@gmail.com
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry A. Kazakov @ 2009-10-16  7:33 UTC (permalink / raw)


On Thu, 15 Oct 2009 18:22:49 -0700 (PDT), RasikaSrinivasan@gmail.com wrote:

> I have a piece of code that reads :
> --------------------
>       Gtk.Text_Attributes.Gtk_New(Special_Atr);
>       Gdk.Color.Set_Rgb( Fg , 16#Ffff# , 0 , 0 ) ;
>       Gtk.Text_Attributes.Set_Fg_Color
> (Gtk.Text_Attributes.Get_Appearance(Special_Atr),Fg);
> ---------------
> 
> I am getting the following error while linking:
> 
> C:\Projects\Gtk\regexp>gprbuild -p -Pregexp
> creating auto.cgpr
> gcc -c -g -gnat05 -gnata regexp_widgets.adb
> regexp_widgets.adb:41:04: warning: variable "Normal_Atr" is never read
> and never assigned
> regexp_widgets.adb:126:07: warning: variable "Searchbtn" is never read
> and never assigned
> gprbind regexp.bexch
> gnatbind regexp.ali
> gcc -c b__regexp.adb
> gcc regexp.o -L/minsk.a/gnatmail/gcc-43/build-minsk/gtkada/install/lib/
> gtkada/static -Wl,-luuid -L/minsk.a/gnatmail/gcc-43/install-minsk/gtk/
> lib -L/unix/gtk+gps/
> gimpwin-dev/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -limm32 -lshell32 -
> lole32 -latk-1.0 -lgdk_pixbuf-2.0 -ljpeg -lpng -lpangocairo-1.0 -
> lcairo -lpangowin32-1.0 -lgdi
> 32 -lpango-1.0 -lm -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -
> luser32 -Lc:\gnat\2009\gtkada\lib\gnat\.. -Lc:\gnat\2009\gtkada\lib
> \gnat\../../include/gtkada -
> o regexp.exe
> c:\projects\gtk\regexp\.objs\regexp_widgets.o: In function
> `regexp_widgets__make':
> c:/projects/gtk/regexp/regexp_widgets.adb:180: undefined reference to
> `_ada_text_attribute_get_appearance'
> collect2: ld returned 1 exit status
> gprbuild: link of regexp.adb failed
> 
> ------------------------------------------
> Sounds like a bug to me. Any ideas?

I don't see linking your program with libgtkada.a. You probably have some
problem either in the project file or else in the GtkAda installation.

BTW. There is an advanced text editor in Gtk:

http://projects.gnome.org/gtksourceview

on top of the Gtk.Text_View, with an integrated language syntax
highlighting, undo buffer etc.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



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

* Re: Bug in GtkAda
  2009-10-16  7:33 ` Dmitry A. Kazakov
@ 2009-10-16 10:20   ` RasikaSrinivasan@gmail.com
  2009-10-16 18:32     ` Dmitry A. Kazakov
  0 siblings, 1 reply; 4+ messages in thread
From: RasikaSrinivasan@gmail.com @ 2009-10-16 10:20 UTC (permalink / raw)


On Oct 16, 3:33 am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> On Thu, 15 Oct 2009 18:22:49 -0700 (PDT), RasikaSriniva...@gmail.com wrote:
> > I have a piece of code that reads :
> > --------------------
> >       Gtk.Text_Attributes.Gtk_New(Special_Atr);
> >       Gdk.Color.Set_Rgb( Fg , 16#Ffff# , 0 , 0 ) ;
> >       Gtk.Text_Attributes.Set_Fg_Color
> > (Gtk.Text_Attributes.Get_Appearance(Special_Atr),Fg);
> > ---------------
>
> > I am getting the following error while linking:
>
> > C:\Projects\Gtk\regexp>gprbuild -p -Pregexp
> > creating auto.cgpr
> > gcc -c -g -gnat05 -gnata regexp_widgets.adb
> > regexp_widgets.adb:41:04: warning: variable "Normal_Atr" is never read
> > and never assigned
> > regexp_widgets.adb:126:07: warning: variable "Searchbtn" is never read
> > and never assigned
> > gprbind regexp.bexch
> > gnatbind regexp.ali
> > gcc -c b__regexp.adb
> > gcc regexp.o -L/minsk.a/gnatmail/gcc-43/build-minsk/gtkada/install/lib/
> > gtkada/static -Wl,-luuid -L/minsk.a/gnatmail/gcc-43/install-minsk/gtk/
> > lib -L/unix/gtk+gps/
> > gimpwin-dev/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -limm32 -lshell32 -
> > lole32 -latk-1.0 -lgdk_pixbuf-2.0 -ljpeg -lpng -lpangocairo-1.0 -
> > lcairo -lpangowin32-1.0 -lgdi
> > 32 -lpango-1.0 -lm -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -
> > luser32 -Lc:\gnat\2009\gtkada\lib\gnat\.. -Lc:\gnat\2009\gtkada\lib
> > \gnat\../../include/gtkada -
> > o regexp.exe
> > c:\projects\gtk\regexp\.objs\regexp_widgets.o: In function
> > `regexp_widgets__make':
> > c:/projects/gtk/regexp/regexp_widgets.adb:180: undefined reference to
> > `_ada_text_attribute_get_appearance'
> > collect2: ld returned 1 exit status
> > gprbuild: link of regexp.adb failed
>
> > ------------------------------------------
> > Sounds like a bug to me. Any ideas?
>
> I don't see linking your program with libgtkada.a. You probably have some
> problem either in the project file or else in the GtkAda installation.
>
> BTW. There is an advanced text editor in Gtk:
>
> http://projects.gnome.org/gtksourceview
>
> on top of the Gtk.Text_View, with an integrated language syntax
> highlighting, undo buffer etc.
>
> --
> Regards,
> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de

This program under development had been linking fine till I added the
references to text_appearance and text_attributes.

My assumption is -Lc:\gnat\2009\gtkada\lib in the command line pulls
the gtkada library (I suspect there is a pragma in the GtkAda source
somewhere to specify library). (I am including the gtkada.gpr).

Anycase, I should look at the syntax coloring example. I think I have
seen your Ada bindings. I will definitely take a look.

Thanks, srini



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

* Re: Bug in GtkAda
  2009-10-16 10:20   ` RasikaSrinivasan@gmail.com
@ 2009-10-16 18:32     ` Dmitry A. Kazakov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry A. Kazakov @ 2009-10-16 18:32 UTC (permalink / raw)


On Fri, 16 Oct 2009 03:20:39 -0700 (PDT), RasikaSrinivasan@gmail.com wrote:

> My assumption is -Lc:\gnat\2009\gtkada\lib in the command line pulls
> the gtkada library (I suspect there is a pragma in the GtkAda source
> somewhere to specify library). (I am including the gtkada.gpr).

Yes, you seem to be right. I have looked at the sources, and it is almost
certainly a bug. libgtkada.a does not contain
_ada_text_attribute_get_appearance (nm does not list it).

The problem is that Get_Appearance is a macro, not a library Gtk operation.
This is the reason why AdaCore put it into the library, though it could
rather place it in the sources.

You could implement it yourself looking at the structure GtkTextAttributes.
See here:

http://library.gnome.org/devel/gtk/stable/GtkTextTag.html#GtkTextAttributes

It seems that you could just convert Gtk_Text_Attribute to
Gtk_Text_Appearance since both are bare pointers to a prefix of another.
E.g.

   function Get_Appearance (Text_Attr : Gtk_Text_Attributes)
      return Gtk_Text_Appearance is
   begin
      return Gtk_Text_Appearance ((Text_Attr);
   end Get_Appearance;

(I didn't try it)

> Anycase, I should look at the syntax coloring example. I think I have
> seen your Ada bindings. I will definitely take a look.

GtkSourceView comes with a library of language syntax descriptions.
Probably your language is already there, e.g. it has Ada. BTW, this one
used by GNOME;s gedit, which is based on GtkSourceView. If you need to
create yours, there is a how-to:

http://library.gnome.org/devel/gtksourceview/stable/lang-tutorial.html

I wrote one for the FCL, it wasn't that difficult, despite XML/RegEx suff.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



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

end of thread, other threads:[~2009-10-16 18:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-16  1:22 Bug in GtkAda RasikaSrinivasan@gmail.com
2009-10-16  7:33 ` Dmitry A. Kazakov
2009-10-16 10:20   ` RasikaSrinivasan@gmail.com
2009-10-16 18:32     ` Dmitry A. Kazakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox