[GRASSLIST:2388] code example plotRasterMap from progmangrass50

Hi
I try to get started with Grass programming with the code example on p.264 from the progmangrass50.After getting help concerning the Gmakefile i got stuck now:
when executing the executable, it stops with (i guess it hangs)
B

(after some typing some returns)

=full_screen
full_screen : unknown error
Bfull_screen
ERROR: Current graphics frame not available

I tried to debug the error, but i get deeper and deeper into the source code:
framestack (with backtrace in gdb). somewhere in D_get_cur_wind it stops.

#0 D_get_cur_wind (name=0xbfffed70 "\200ý\034@") at window.c:153
#1 0x0804ac76 in D_setup (clear=1) at setup.c:32
#2 0x080498db in plot_raster_map (name=0x8062bf4 "elevation.dem",
    mapset=0x8062bea "PERMANENT", overlay=0) at plotRasterMap.c:12
#3 0x080498ae in main (argc=1, argv=0x1) at ctest.c:18
#4 0x400b58ae in __libc_start_main () from /lib/libc.so.6

- I work with Grass 5.0.3 (compiled from source). Since I'm not root, i've installed grass on custom paths.
- I use tcsh. I've experimented to start Grass from bash, but this didn't help
- I've read smth about writing a graphics driver (p. 407 in progmangrass50), i tried to look a the mentioned files, e.g Gisbase/src.D/devices or GENERIC, but in my installation there not there. ???

I very much appreciate all advices Thanks dani

ps this is my config-statement and the config-info from GRASS (I doubt if i configured grass wrong)

./configure --prefix=/data/gis/nfp48/nfp48/ipodlas0.1/grass --with-bindir=/data/gis/nfp48/nfp48/ipodlas0.1/grass --without-gd --with-postgres --with-postgres-includes=/data/gis/nfp48/nfp48/ipodlas0.1/lib/postgresql-7.4.1/include/ --with-postgres-libs=/data/gis/nfp48/nfp48/ipodlas0.1/lib/postgresql-7.4.1/lib/ --with-odbc --with-odbc-includes=/data/gis/nfp48/nfp48/ipodlas0.1/lib/unixODBC-2.2.7/include/ --with-odbc-libs=/data/gis/nfp48/nfp48/ipodlas0.1/lib/unixODBC-2.2.7/lib --without-fftw --enable-socket | & tee compileOutput.log

Copying config.status to config.status.i686-pc-linux-gnu
GRASS is now configured for i686-pc-linux-gnu
   Source directory: /data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5sources/grass-5.0.3
  Build directory: /home/gis/disen/links/ipodlas0.1/grass/grass5sources/grass-5.0.3
  Installation directory: /data/gis/nfp48/nfp48/ipodlas0.1/grass/grass5
  C compiler: gcc -g -O2
  FORTRAN compiler: g77
   NVIZ: yes
   X11 support: yes
  DBM support: no
  JPEG support: yes
  TIFF support: yes
  PNG support: yes
  GD support: no
  Tcl/Tk support: yes
  PostgreSQL support: yes
  OpenGL(R) support: yes
  ODBC support: yes
  FFTW support: no
  BLAS support: no
  LAPACK support: no
  Motif support: no
  FreeType support: no
  GLw support: no
  NLS support: no
  Readline support: no

Daniel Isenegger wrote:

I try to get started with Grass programming with the code example on
p.264 from the progmangrass50.

Can you provide a section number? Page numbers aren't much help; they
change whenever something is added or removed.

--
Glynn Clements <glynn.clements@virgin.net>

Glynn Clements schrieb:

Daniel Isenegger wrote:

I try to get started with Grass programming with the code example on p.264 from the progmangrass50.
   
Can you provide a section number? Page numbers aren't much help; they
change whenever something is added or removed.

Yes, of course:
16.6 Raster Graphics in 16. Display Graphics library

Daniel Isenegger wrote:

I try to get started with Grass programming with the code example on
p.264 from the progmangrass50.

I don't know how much has changed since the version which I'm looking
at, but the code in my version needed quite a few changes just to
compile.

After getting help concerning the
Gmakefile i got stuck now:
when executing the executable, it stops with (i guess it hangs)
B

(after some typing some returns)

=full_screen
full_screen : unknown error
Bfull_screen
ERROR: Current graphics frame not available

I tried to debug the error, but i get deeper and deeper into the source
code:
framestack (with backtrace in gdb). somewhere in D_get_cur_wind it stops.

#0 D_get_cur_wind (name=0xbfffed70 "\200ý\034@") at window.c:153
#1 0x0804ac76 in D_setup (clear=1) at setup.c:32
#2 0x080498db in plot_raster_map (name=0x8062bf4 "elevation.dem",
    mapset=0x8062bea "PERMANENT", overlay=0) at plotRasterMap.c:12
#3 0x080498ae in main (argc=1, argv=0x1) at ctest.c:18
#4 0x400b58ae in __libc_start_main () from /lib/libc.so.6

AFAICT, this is because you haven't called R_open_driver().

One other problem with my version of the code is that the line:

  if (D_cell_draw_setup(&top, &bottom, &left, &right))

should be:

  if (D_cell_draw_setup(top, bottom, left, right))

I've attached a modified version which actually runs.

- I work with Grass 5.0.3 (compiled from source). Since I'm not root,
i've installed grass on custom paths.
- I use tcsh. I've experimented to start Grass from bash, but this
didn't help
- I've read smth about writing a graphics driver (p. 407 in
progmangrass50), i tried to look a the mentioned files, e.g
Gisbase/src.D/devices or GENERIC, but in my installation there not
there. ???

The driver code is in src/display/devices. Common code is in the lib
subdirectory; the driver-specific code is in the CELL, PNGdriver and
XDRIVER directories.

--
Glynn Clements <glynn.clements@virgin.net>

(attachments)

displaytest.c (1.18 KB)

On Thu, Jan 29, 2004 at 05:37:37PM +0000, Glynn Clements wrote:
Content-Description: message body text

Daniel Isenegger wrote:

> I try to get started with Grass programming with the code example on
> p.264 from the progmangrass50.

I don't know how much has changed since the version which I'm looking
at, but the code in my version needed quite a few changes just to
compile.

> After getting help concerning the
> Gmakefile i got stuck now:
> when executing the executable, it stops with (i guess it hangs)
> B
>
> (after some typing some returns)
>
> =full_screen
> full_screen : unknown error
> Bfull_screen
> ERROR: Current graphics frame not available
>
>
> I tried to debug the error, but i get deeper and deeper into the source
> code:
> framestack (with backtrace in gdb). somewhere in D_get_cur_wind it stops.
>
> #0 D_get_cur_wind (name=0xbfffed70 "\200ý\034@") at window.c:153
> #1 0x0804ac76 in D_setup (clear=1) at setup.c:32
> #2 0x080498db in plot_raster_map (name=0x8062bf4 "elevation.dem",
> mapset=0x8062bea "PERMANENT", overlay=0) at plotRasterMap.c:12
> #3 0x080498ae in main (argc=1, argv=0x1) at ctest.c:18
> #4 0x400b58ae in __libc_start_main () from /lib/libc.so.6

AFAICT, this is because you haven't called R_open_driver().

One other problem with my version of the code is that the line:

  if (D_cell_draw_setup(&top, &bottom, &left, &right))

should be:

  if (D_cell_draw_setup(top, bottom, left, right))

I've attached a modified version which actually runs.

I have updated the section in progman-CVS with that code version and
updated the online PDF as well.

Markus