GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
Interactive call functions. More...
#include <grass/config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <grass/vask.h>
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__ |
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
Definition in file V_call.c.
#define ANSWER scr_answ[at_answer].position |
#define COL V__.usr_answ[at_answer].col |
#define LENGTH V__.usr_answ[at_answer].length |
#define RELINE |
#define ROW V__.usr_answ[at_answer].row |
#define TARGET V__.usr_answ[at_answer].targetptr |
#define TYPE V__.usr_answ[at_answer].var_type |
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().
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().
[in] | msg |
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.
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().
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().