GRASS Programmer's Manual  6.4.2(2012)
V_ques.c
Go to the documentation of this file.
00001 
00028 #include <grass/vask.h>
00029 
00030 
00080 int V_ques(void *src, int var_type, int row, int col, int length)
00081 {
00082     union target targetptr;
00083 
00084     targetptr.i = src;
00085 
00086     if (V__.NUM_ANSW >= MAX_ANSW) {
00087         V_error("Too many questions in call to V_ques");
00088         return (-1);
00089     }
00090     if ((row < 0) || (row >= MAX_LINE)) {
00091         V_error("Illegal row (%d) in call to V_ques", row);
00092         return (-1);
00093     }
00094     if ((col < 0) || (col >= 80)) {
00095         V_error("Illegal column (%d) in call to V_ques", col);
00096         return (-1);
00097     }
00098     if (length <= 0) {
00099         V_error("Negative length in call to V_ques");
00100         return (-1);
00101     }
00102     if (length + col > 80)
00103         length = 80 - col;
00104 
00105     if ((var_type == 's') || (var_type == 'i') || (var_type == 'f')
00106         || (var_type == 'l') || (var_type == 'd')) {
00107         V__.usr_answ[V__.NUM_ANSW].targetptr = targetptr;
00108         V__.usr_answ[V__.NUM_ANSW].var_type = var_type;
00109         V__.usr_answ[V__.NUM_ANSW].row = row;
00110         V__.usr_answ[V__.NUM_ANSW].col = col;
00111         V__.usr_answ[V__.NUM_ANSW].length = length;
00112         V__.usr_answ[V__.NUM_ANSW].decimal_places = V__.decimal_places;
00113 
00114         V__.NUM_ANSW++;
00115         return (0);
00116     }
00117     else {
00118         V_error("Illegal variable type in call to V_ques");
00119         return (-1);
00120     }
00121 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines