GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
V_ques.c
Go to the documentation of this file.
1 
28 #include <grass/vask.h>
29 
30 
80 int V_ques(void *src, int var_type, int row, int col, int length)
81 {
82  union target targetptr;
83 
84  targetptr.i = src;
85 
86  if (V__.NUM_ANSW >= MAX_ANSW) {
87  V_error("Too many questions in call to V_ques");
88  return (-1);
89  }
90  if ((row < 0) || (row >= MAX_LINE)) {
91  V_error("Illegal row (%d) in call to V_ques", row);
92  return (-1);
93  }
94  if ((col < 0) || (col >= 80)) {
95  V_error("Illegal column (%d) in call to V_ques", col);
96  return (-1);
97  }
98  if (length <= 0) {
99  V_error("Negative length in call to V_ques");
100  return (-1);
101  }
102  if (length + col > 80)
103  length = 80 - col;
104 
105  if ((var_type == 's') || (var_type == 'i') || (var_type == 'f')
106  || (var_type == 'l') || (var_type == 'd')) {
107  V__.usr_answ[V__.NUM_ANSW].targetptr = targetptr;
108  V__.usr_answ[V__.NUM_ANSW].var_type = var_type;
109  V__.usr_answ[V__.NUM_ANSW].row = row;
110  V__.usr_answ[V__.NUM_ANSW].col = col;
111  V__.usr_answ[V__.NUM_ANSW].length = length;
112  V__.usr_answ[V__.NUM_ANSW].decimal_places = V__.decimal_places;
113 
114  V__.NUM_ANSW++;
115  return (0);
116  }
117  else {
118  V_error("Illegal variable type in call to V_ques");
119  return (-1);
120  }
121 }
struct V__ V__
Definition: V_call.c:90
void V_error(const char *fmt,...)
Definition: V_error.c:44
int V_ques(void *src, int var_type, int row, int col, int length)
Definition: V_ques.c:80