[GRASS5] r.le problem with VASKLIB

William L. Baker bakerwl at uwyo.edu
Tue Sep 11 00:17:50 EDT 2001


Hello,

I have been promising for some time to finish the
r.le program revision.  I am close.  I still have
a bug in r.le.setup.  Here is a message that I
sent back in February.  Note that I had already changed
to using fprintf as Markus suggested.  The problem remains.
Any ideas?

Thanks.

Bill Baker
Univ. of Wyoming


________________________________________________________
Hello,

Still struggling with the VASKLIB problem.  I have now
isolated the problem.  It is in my code that uses the
VASKLIB.  If I manually enter values into the array
that is filled by the VASKLIB code, instead of letting
the VASKLIB code do it, the program runs fine.

It appears that the VASKLIB code does not let go of
control of the screen once it is done, as subsequent
attempts by later code to write to the screen fail.
The cursor is hung in the upper left corner after this
VASKLIB code is done.  If I hit Cnt-C, then the program
proceeds.

I wonder if there is someone familiar with the VASKLIB
who could look at my code (attached) to see if there
is anything obvious wrong?  The code is pretty short.

I am not an expert programmer, so someone with more
experience might be able to see the problem easily!

Bill Baker
Univ. of Wyoming


Markus Neteler wrote:
>
> Hi Bill,
>
> On Mon, Feb 12, 2001 at 03:53:13PM -0700, William L. Baker wrote:
> > Anyone had any problem with modules using VASKLIB?
> > My r.le.setup program worked fine under GRASS4.3.
> >
> > Now after the V_ code, when the user has hit esc-return,
> > the screen freezes with the cursor in the upper-left corner.
> > The return values from the V_ code do get passed along
> > OK to subsequent code, but nothing happens because of
> > the screen freeze.
>
> this was a problem in grass5 in past. We fixed it by using
>   fprintf(stderr, ""); or
>   fprintf(stdout, "");
> instead of
>   printf();
>
> > Could be a problem in my own code after the V_ section,
> > but I can't isolate the problem there.
> >
> > In the old 4.3 version, the Gmakefile used VASK, but I
> > have fixed that up to just use VASKLIB as in the updated
> > Gmakefiles in beta 11.
>
> As described in SUBMITTING, the printf() shouldn't be used. Probably
> this helps here if there are printf() in your code?
>
> Kind regards
>
>  Markus Neteler
>
> ----------------------------------------
> If you want to unsubscribe from GRASS Development Team mailing list write
to:
> minordomo at geog.uni-hannover.de with
> subject 'unsubscribe grass5'
--------------C3BB3D2A06B3C7AE997C4EFB
Content-Type: text/plain; charset=us-ascii;
 name="problem.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="problem.txt"

                        /********************************/
                        /*     r.le.setup/ask_group.c   */
                        /*                              */
                        /*           5.0beta            */
                        /*                              */
                        /*      1/1/2001 version        */
                        /*                              */
                        /*      Programmer: Baker       */
                        /*      Univ. of Wyoming        */
                        /********************************/

#include "setup.h"
#include "vask.h"
#include <unistd.h>
#include "gis.h"




                                /* PROMPT THE USER TO SELECT THE GROUP/CLASS
                                   LIMITS */

int   ask_group(sel)
char     **sel;

{

                                /* show the option menu using GRASS VASK
                                   library function*/

  V_clear();
  V_intrpt_msg("EXIT PROGRAM");

  V_line(2, "SELECT ATTRIBUTE GROUP OR INDEX CLASS TO SETUP:");
  V_line(3, "Type 'x' to select; <CR> to go to the next; <space> over to
exclude");
  V_line(5, "r.le.patch");
  V_line(6, "   Attribute Groups");
  V_line(7, "   Size Classes");
  V_line(8, "   Shape Classes");
  V_line(9, "      Perim./Area Index");
  V_line(10, "      Corr. Perim./Area Index");
  V_line(11, "      Rel. Circum. Circle Index");
  V_line(13, "r.le.dist");
  V_line(14, "   Distance Classes");
  V_line(15, "      Center to Center");
  V_line(16, "      Center to Edge");
  V_line(17, "      Edge to Edge");
  V_line(18, "   From & To Groups for di1=m7, m8, or m9");

  V_ques(sel[0], 's', 6, 50, 1);
  V_ques(sel[1], 's', 7, 50, 1);
  V_ques(sel[2], 's', 9, 50, 1);
  V_ques(sel[3], 's', 10, 50, 1);
  V_ques(sel[4], 's', 11, 50, 1);
  V_ques(sel[5], 's', 15, 50, 1);
  V_ques(sel[6], 's', 16, 50, 1);
  V_ques(sel[7], 's', 17, 50, 1);
  V_ques(sel[8], 's', 18, 50, 1);

  V_intrpt_ok();
  if (!V_call())
     return(-1);
  return(1);
}




More information about the grass-dev mailing list