GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
V_call.c File Reference

Interactive call functions. More...

#include <grass/config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <grass/vask.h>
Include dependency graph for V_call.c:

Go to the source code of this file.

Macros

#define DUMP   001
 
#define BS   010
 
#define FS   014
 
#define NL   012
 
#define UP   013
 
#define CR   015
 
#define RPLT   022
 
#define ESC   033
 
#define CTRLC   003
 
#define TARGET   V__.usr_answ[at_answer].targetptr
 
#define ROW   V__.usr_answ[at_answer].row
 
#define COL   V__.usr_answ[at_answer].col
 
#define LENGTH   V__.usr_answ[at_answer].length
 
#define TYPE   V__.usr_answ[at_answer].var_type
 
#define ANSWER   scr_answ[at_answer].position
 
#define RELINE
 

Functions

int V_call (void)
 Interact with the user. More...
 
void V_intrpt_ok (void)
 Allow CTRL-C. More...
 
void V_intrpt_msg (const char *msg)
 Change CTRL-C message. More...
 

Variables

struct V__ V__
 

Detailed Description

Interactive call functions.

(C) 1999-2009 by the GRASS Development Team

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Note
Modified by Jacques Bouchard and Markus Neteler 6/99 to make cursor keys working. Exit now with ESC-CR.
Author
GRASS GIS Development Team
Date
2007-11-01

Definition in file V_call.c.

Macro Definition Documentation

#define ANSWER   scr_answ[at_answer].position

Definition at line 107 of file V_call.c.

Referenced by V_call().

#define BS   010

Definition at line 93 of file V_call.c.

Referenced by V_call().

#define COL   V__.usr_answ[at_answer].col

Definition at line 104 of file V_call.c.

Referenced by V_call().

#define CR   015

Definition at line 97 of file V_call.c.

Referenced by V_call().

#define CTRLC   003

Definition at line 100 of file V_call.c.

Referenced by V_call().

#define DUMP   001

Definition at line 92 of file V_call.c.

Referenced by V_call().

#define ESC   033

Definition at line 99 of file V_call.c.

Referenced by V_call().

#define FS   014

Definition at line 94 of file V_call.c.

Referenced by V_call().

#define LENGTH   V__.usr_answ[at_answer].length

Definition at line 105 of file V_call.c.

Referenced by V_call().

#define NL   012

Definition at line 95 of file V_call.c.

Referenced by V_call().

#define RELINE
Value:
do { \
move(ROW, COL) ; \
for (incr2=0;incr2<LENGTH; incr2++) \
addch('_') ; \
move(ROW, COL) ; \
} while (0)
#define COL
Definition: V_call.c:104
#define LENGTH
Definition: V_call.c:105
#define ROW
Definition: V_call.c:103
for(cat=0;;cat++)
Definition: g3dcats.c:140

Definition at line 108 of file V_call.c.

Referenced by V_call().

#define ROW   V__.usr_answ[at_answer].row

Definition at line 103 of file V_call.c.

Referenced by V_call().

#define RPLT   022

Definition at line 98 of file V_call.c.

Referenced by V_call().

#define TARGET   V__.usr_answ[at_answer].targetptr

Definition at line 102 of file V_call.c.

Referenced by V_call().

#define TYPE   V__.usr_answ[at_answer].var_type

Definition at line 106 of file V_call.c.

Referenced by V_call().

#define UP   013

Definition at line 96 of file V_call.c.

Referenced by V_call().

Function Documentation

int V_call ( void  )

Interact with the user.

Interactively allow the user to enter answers into all available fields (as previously defined). Answer fields have been created with calls to V_ques(). Information fields have been created using V_const(). General text has been created with calls to V_line().

V_call() clears the screen and writes the text and data values specified by V_line(), V_ques() and V_const() to the screen. It interfaces with the user, collecting user responses in the V_ques() fields until the user is satisfied. A message is automatically supplied on line number 23, explaining to the user to enter an ESC when all inputs have been supplied as desired. V_call() ends when the user hits ESC and returns a value of 1 (but see V_intrpt_ok() below). No error checking is done by V_call(). Instead, all variables used in V_ques() calls must be checked upon return from V_call(). If the user has supplied inappropriate information, the user can be informed, and the input prompted for again by further calls to V_call().

Returns
1 user entered ESC to continue
0 user entered CTRL-C to cancel
-1 no match

Definition at line 149 of file V_call.c.

References ANSWER, BS, COL, CR, CTRLC, DUMP, ERR, ESC, FS, LENGTH, NL, RELINE, ROW, RPLT, sprintf(), TARGET, TYPE, UP, V__, V__dump_window(), V__remove_trail(), V_exit(), V_init(), and y.

Referenced by E_edit_cats(), E_edit_cellhd(), E_edit_fp_cats(), E_edit_history(), and main().

int V_intrpt_msg ( const char *  msg)

Change CTRL-C message.

A call to V_intrpt_msg() changes the default V_intrpt_ok() message from (OR <CTRL-C> TO CANCEL) to (OR <CTRL-C> TO msg). The message is (re)set to the default by V_clear().

Parameters
[in]msg
Returns
always returns 0

Definition at line 475 of file V_call.c.

References V__.

int V_intrpt_ok ( void  )

Allow CTRL-C.

V_call() normally only allows the ESC character to end the interactive input session. Sometimes, it is desirable to allow the user to cancel the session. To provide this alternate means of exit, the programmer can call V_intrpt_ok() before V_call(). This allows the user to enter CTRL-C, which causes V_call() to return a value of 0 instead of 1.
A message is automatically supplied to the user on line 23 saying to use CTRL-C to cancel the input session. The normal message accompanying V_call() is moved up to line 22.
Note: When V_intrpt_ok() is called, the programmer must limit the use of V_line(), V_ques(), and V_const() to lines 0-21.

Returns
always returns 0

Definition at line 455 of file V_call.c.

Referenced by E_edit_cats(), E_edit_cellhd(), E_edit_fp_cats(), E_edit_history(), and main().

Variable Documentation

struct V__ V__

Definition at line 90 of file V_call.c.

Referenced by V_call(), V_clear(), V_const(), V_float_accuracy(), V_intrpt_msg(), V_line(), and V_ques().